BookmarkSubscribeRSS Feed
deleted_user
Not applicable
input id cwk :$4. wk day x y;
datalines;
1 sc 0 1 11 10
1 wk1 1 1 12 20
1 wk1 1 2 23 34
1 wk10 10 1 13 30
1 wk10 10 2 33 45
1 wk4 4 1 14 40
2 sc 0 1 13 15
2 sc 0 2 23 43
2 wk1 1 1 14 25
2 wk1 1 2 24 35
2 wk10 10 1 15 35
2 wk10 10 2 45 56
2 wk3 3 1 16 45
2 wk3 3 2 36 46
2 wk4 4 1 17 55
;
I have above data and written the following code
proc sort data=test;
by week;
run;
proc report data=test(drop=wk) nowd;
columns cwk day id,(x y);
*define wk/group order=data noprint;
define cwk/group "week";

define day/group "Day";
define id/across "ID";
define x/ "X";
define y/ "Y";
run;
getting output as follows
ID
1 2
week Day X Y X Y
sc 1 11 10 13 15
2 . . 23 43
wk1 1 12 20 14 25
2 23 34 24 35
wk10 1 13 30 15 35
2 33 45 45 56
wk3 1 . . 16 45
2 . . 36 46
wk4 1 14 40 17 55
but not getting the output in asending sequence of the week.
but I want to display wk10 after wk3, wk4. I mean I just want to display week in asending sequence.
1 REPLY 1
deleted_user
Not applicable
It has been resolved, small mistake. Thank you

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!

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
  • 557 views
  • 0 likes
  • 1 in conversation