DATA C ;
INPUT ID $ STATE $ CITY $ COUPON $ ;
CARDS ;
101 TEL HYD A
101 TEL WAR B
101 AP VIJ A
101 AP GUN B
101 AP VIZ B
102 TEL HYD B
102 TEL WAR A
102 AP VIJ B
102 AP GUN A
102 AP VIZ B
;
By using above dataset how to take frequncey as state wise and city wise final i want to get data like this
ID STATE/CITY A B
101 AP 2 4
GUN 1 1
VIJ 1 1
VIZ 0 2
102 TEL 2 1
HYD 1 1
WAR 0 1
Is STATE/CITY a single variable here?
And how is B=4 for ID=101? PLease be more specific about how the desired data set is structured
One way is:
proc tabulate data=c;
class id state city coupon;
table id*(state all=' ')*city,
coupon=' '*n=' '
/ nocellmerge misstext='0'
;
run;
Proc Tabulate by default will not use any record with a missing value for any of the class variables. So that may need to be checked before use.
i want state and city keep in one variable how will we do?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.