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
| Name | Sex | Age |
| Alfred | Male | 14 |
| Alice | Female | 13 |
| Barbara | Female | 13 |
| Carol | Female | 14 |
| Henry | Male | 14 |
| James | Male | 12 |
| Jane | Female | 12 |
| Janet | Female | 15 |
| Jeffrey | Male | 13 |
| John | Male | 12 |
| Joyce | Female | 11 |
| Judy | Female | 14 |
| Louise | Female | 12 |
| Mary | Female | 15 |
| Philip | Male | 16 |
| Robert | Male | 12 |
| Ronald | Male | 15 |
| Thomas | Male | 11 |
| William | Male | 15 |
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;
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.
i want in proc report
Then you only need to read the documentation I linked and apply what you learn from it.
sorry i cannot undertand clearly
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;
Hi Jagadeesh
Thank your very much for your support![]()
@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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.