BookmarkSubscribeRSS Feed
vsl2000
Calcite | Level 5

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,

 

ToriExSu.pngExEx.png

1 REPLY 1
Reeza
Super User

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,

 

ToriExSu.pngExEx.png


 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 616 views
  • 0 likes
  • 2 in conversation