Hi all,
First Statalist post and beginner on Stata so thank you for your patience!
I am trying to create a single Excel worksheet which will have one row for every error in our dataset. I'm using Stata version 14.2. I have already created the code to identify errors - probably not the smoothest way, but for each variable (e.g. height), I created a new variable (e.g. heightx) whose value is 1 if an error in that variable is detected. My dataset consists of 3,900 observations, each of which represents a form completed by a participant. (About 2,000 participants have completed anywhere between 1-6 forms). The 2,000 participants are identified by an id variable (rid) and the forms have their own variable (form).
In my example, if the value of heightx = 1 for a given form, I would like to export 4 characteristics (id, facility, visit date and form number) taken from the row this is true from. I've used mkmat to create a matrix of these values, and putexcel to export the results to an Excel worksheet. However, I have hundreds of variables I'll be checking for errors on. Rather than have to export the matrix results each time manually, I was hoping to create a loop (I think using foreach?) and have all the matrix results export at once - stacking vertically within a single Excel worksheet. However, since the number of errors identified in a given variable will constantly be changing (one week there might be 5 errors in heightx, another week 155), I can't predict what row/cell number the second, third and subsequent matrix results will export to.
Is there a way to tell Stata: "export the results of the heightx matrix to Excel and put those in cell A2, and then export the results of the weightx matrix to that same worksheet, beginning at the next blank row"? I did see this post but wasn't quite sure if it's the same thing I'm trying to do...
Thanks for your help,
~Cristina
Related Posts with Stacking results from multiple matrices using putexcel
How to calculate auditor busyness?Dear teachers, there are two problems that have plagued my first question recently. The first questi…
transparency in points on graphHi, I know there is an option to add transparency to data on a scatter plot in stata 15 but is it p…
How do you measure the amount of countries that have values for at least one year with panel data?Dear Statlisters, Probably this question is asked before, but I could not find clear answer. I am …
Does Keep command work with non numeric variables?Hello, I am quite new to stata so sorry if this has been answered before, but I could not find it v…
using non-standard schemes on locked-down computersI'm using a server for which I do not have administrator rights, and thus must direct Stata to look …
Subscribe to:
Post Comments (Atom)
0 Response to Stacking results from multiple matrices using putexcel
Post a Comment