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

Hi Experts 

Good Afternoon,

 

i trying to change format in sashelp.class 

where sex F as Female

                  M as Male

data ds;
set sashelp.class;
run;

proc format ;
value $sex 'F'='Female'
           'M'='Male';
run;

proc report data= ds;
column name sex age;
define name/display;
define sex/display;
define age/display;
run;

 

 

i want to put like below can we do in proc report

 

NameSexAge
AlfredMale14
AliceFemale13
BarbaraFemale13
CarolFemale14
HenryMale14
JamesMale12
JaneFemale12
JanetFemale15
JeffreyMale13
JohnMale12
JoyceFemale11
JudyFemale14
LouiseFemale12
MaryFemale15
PhilipMale16
RobertMale12
RonaldMale15
ThomasMale11
WilliamMale15
1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

Please try the below code with format option in proc report

 

proc format ;
value $sex 'F'='Female'
           'M'='Male';
run;

proc report data= ds;
column name sex age;
define name/display;
define sex/display format=$sex.;
define age/display;
run;
Thanks,
Jag

View solution in original post

7 REPLIES 7
Kurt_Bremser
Super User

If you want to have any effect from your format, you need to use it, either in the data step that creates the data, or in the report procedure.

Read the documentation for the DEFINE statement to see how it's done.

BrahmanandaRao
Lapis Lazuli | Level 10

i want in proc report 

BrahmanandaRao
Lapis Lazuli | Level 10

sorry i cannot undertand clearly

Jagadishkatam
Amethyst | Level 16

Please try the below code with format option in proc report

 

proc format ;
value $sex 'F'='Female'
           'M'='Male';
run;

proc report data= ds;
column name sex age;
define name/display;
define sex/display format=$sex.;
define age/display;
run;
Thanks,
Jag
BrahmanandaRao
Lapis Lazuli | Level 10

Hi Jagadeesh  

Thank your very much  for your supportSmiley Very Happy

 

Kurt_Bremser
Super User

@BrahmanandaRao wrote:

sorry i cannot undertand clearly


It is in fact so simple that I won't insult your intelligence by spoon-feeding it. If you could not manage it on your own, you would be too dumb to work with SAS, and you aren't. Do a little work and thinking by yourself.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2056 views
  • 1 like
  • 3 in conversation