Hello All,
SAS 9.4
I am analysing a survey where responses are recorded in numeric form, "4 times a week" being recorded as 43 for example. Example pictures are attached.
For the export of my analysis, for example a proc freq of a question, is there a way to have the responses displayed in their text form? A line I could write that requests 43 to be displayed as "4 times a week" in output?
This would make looking at the results much easier on the eyes.
I've already found a way to change the column names to the question numbers. Here is my code:
data survey;
set mylib.thesisdata2;
rename VAR4=Q1;
rename VAR5=Q2;
rename VAR6=Q3;
rename VAR16=Q5;
rename VAR17=Q6;
rename VAR28=Q8;
rename VAR58=Q14;
rename VAR59=Q15;
rename VAR60=Q16;
rename VAR95=Q21;
run;
proc freq data=survey;
tables Q1 Q2 Q3 Q5 Q6 Q8 Q14 Q15 Q16 Q21;
proc print;
run;
Cheers,
Tori
Apply formats.
That way you can reuse the same format on multiple questions, possibly surveys, and you're not changing the underlying data which makes it easier to do summaries and analysis and have things in the order you expect.
http://www2.sas.com/proceedings/sugi30/001-30.pdf
@vsl2000 wrote:
Hello All,
SAS 9.4
I am analysing a survey where responses are recorded in numeric form, "4 times a week" being recorded as 43 for example. Example pictures are attached.
For the export of my analysis, for example a proc freq of a question, is there a way to have the responses displayed in their text form? A line I could write that requests 43 to be displayed as "4 times a week" in output?
This would make looking at the results much easier on the eyes.
I've already found a way to change the column names to the question numbers. Here is my code:
data survey;
set mylib.thesisdata2;
rename VAR4=Q1;
rename VAR5=Q2;
rename VAR6=Q3;
rename VAR16=Q5;
rename VAR17=Q6;
rename VAR28=Q8;
rename VAR58=Q14;
rename VAR59=Q15;
rename VAR60=Q16;
rename VAR95=Q21;
run;proc freq data=survey;
tables Q1 Q2 Q3 Q5 Q6 Q8 Q14 Q15 Q16 Q21;
proc print;
run;
Cheers,
Tori
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.