- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have a pretty dense dataset that I would like to organize so I can run proc univariate or proc freq reports on it.
I would like to the first report to find the number of reads (obs) per machine per Mode. And the second report to find the number of reads per Machine per Mode per Study. So I would like to try to create a dummy variable to make that easier, I put two columns to show what I think the dummy variables should look like, but I am not sure whether this is the best way. Any advice is much appreciated!
A sample of the dataset is below:
Mode Study Machine Dummy1?? Dummy2??
EN A M1 EN-M1 EN-M1-A
EN A M2 EN-M2 EN-M1-A
EN B M1 EN-M1 EN-M1-B
HIS A M3 HIS-M3 HIS-M3-A
HIS C M3 HIS-M3 HIS-M3-C
HIS C M2 HIS-M2 HIS-M3-C
MR B M1 MR-M1 MR-M1-B
MR D M2 MR-M2 MR-M2-D
MR D M2 MR-M2 MR-M2-D
MR D M3 MR-M3 MR-M3-D
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Depends on what you mean by 'nice report' but it's definitely possible. The results are also in data sets want1, want2.
You could wrap the code in ODS EXCEL and see how that works:
I find tabulate easier to control though.
ods excel file='/folders/myfolders/demo.xlsx';
{code from previous post};
{OR proc tabulate code};
ods excel close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
None of this is necessary, nor is it a good idea.
PROC FREQ does all of this, without any dummy variables at all.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Not sure why you need dummy variables. See the want/want2 data set or output from the following. The LIST option tells SAS to arrange it in a list rather than cross tab.
proc freq data=have /*noprint*/;
table mode*machine / list out=want1;
table mode*machine*study/ list out=want2;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza,
I see, that makes more sense. Is it possible to then export this into an excel file so that it looks like a nice report with Proc Freq?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Depends on what you mean by 'nice report' but it's definitely possible. The results are also in data sets want1, want2.
You could wrap the code in ODS EXCEL and see how that works:
I find tabulate easier to control though.
ods excel file='/folders/myfolders/demo.xlsx';
{code from previous post};
{OR proc tabulate code};
ods excel close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Reeza! I am going to go ahead and try that now
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dummy1 = CATX('-', Mode, Machine);