BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

 

I want to use user defined format in order to use new groups of variable Z1.

What is the way to modify proc tabulate code in order to use formatted groups of Z1?

 

proc format ;
value  Z1Fmt
2-4='2-4'
5-6='5-6'
;
Run;

 

 

data rawdata;
input ID  Z1  Z2 $;
cards;
1 2 xjfjjj
2 3 djdjdj
3 3 xjfjjj
4 4 djdjdj
5 5 xjfjjj
6 5 djdjdj
7 6 djdjdj
8 6 asasas
9 6 asasas
10 6 djdjdj
;
run;

 
PROC tabulate DATA=rawdata  ;
class z2/order=freq;
class z1/order=internal;
TABLE  z2=' ' all,z1*n*f=8.0 all*n*f=8.0/printmiss box='z2' misstext='0';
keylabel n=' ';
RUN;
1 REPLY 1
Ronein
Meteorite | Level 14

I found the solution.

proc format ;
value Z1Fmt
2-4='2-4'
5-6='5-6'
;
Run;

PROC tabulate DATA=rawdata  ;
class z2/order=freq;
class z1/order=internal;
TABLE  z2=' ' all,z1*n*f=8.0 all*n*f=8.0/printmiss box='z2' misstext='0';
keylabel n=' ';
format Z1 Z1Fmt.;
RUN;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 382 views
  • 2 likes
  • 1 in conversation