BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

I am attempting to change the printed out data from originally  X for True and a Blank for no entry/false to changing that X to Yes and the blank to No.

I am also trying to  change printout values of 13-19 to being labeled  "teens" and 20s, 30s and so on for an age input value.

     Example- Age 15 would read out as "teen"

                     Age 92 = "nineties"

Any Advice would be great!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

proc format;

value $YN

'X' = 'Yes'

' ','' ='No'  /* this line includes 2 single quotes with a space and just 2 single quotes depending on how your data as a "blank" is created both may be needed*/

;

Value agegroup

13-19='Teen'

20-29='20s'

30-39='30s'

<follow obvious pattern>

90-99='90s'

100-high='100+';

run;

Useage example:

proc print data=yourdatesetnamegoeshere;

var YesNo age;

format YesNo $YN. age agegroup. ;

run;

where YesNo is your variable with X/blank coding and Age is the variable with ages.

View solution in original post

1 REPLY 1
ballardw
Super User

proc format;

value $YN

'X' = 'Yes'

' ','' ='No'  /* this line includes 2 single quotes with a space and just 2 single quotes depending on how your data as a "blank" is created both may be needed*/

;

Value agegroup

13-19='Teen'

20-29='20s'

30-39='30s'

<follow obvious pattern>

90-99='90s'

100-high='100+';

run;

Useage example:

proc print data=yourdatesetnamegoeshere;

var YesNo age;

format YesNo $YN. age agegroup. ;

run;

where YesNo is your variable with X/blank coding and Age is the variable with ages.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 714 views
  • 0 likes
  • 2 in conversation