BookmarkSubscribeRSS Feed
ybz12003
Rhodochrosite | Level 12

Hello,

 

In my sample test dataset, is there a way to get counts in Order_Test variable and assign descending date in the date variable? 

Proc report data=Test;
 	column Health_Department epi_message_sender eor_spec_id Order_Test Updated_Date;
	define Health_Department / group ;
	define epi_message_sender / group ;
	define eor_spec_id / group ;
	define Order_Test / group ;
	define Updated_Date / group ;
run;
5 REPLIES 5
ballardw
Super User

Tested code requires example data.

Which do you want the value of Order_test to serve as a group, the count of Order_test (which would be a poor group value) or both?

If you want both here is an example using an alias with a data set you should have so you can test the code.

proc report data=class;
   columns sex age age=agen ;
   define sex /group;
   define age /group;
   define agen/ n 'Age count';
run;

 

A specific order of values, such as descending date value, if Updated_date is indeed a date value (Guessing here as no example data provided), often requires sorting data and using the Define option Order=data to display them in the order they appear in the data set for group, order or across variables.

ybz12003
Rhodochrosite | Level 12
My Order_Test variable is a character, not numeric.
Tom
Super User Tom
Super User

@ybz12003 wrote:
My Order_Test variable is a character, not numeric.

Ok. So?  What does that mean in terms of what type of report you want?

 

Your original post did not really explain what you wanted.  You might be able to make it clearer by sharing some example data and what report you want from that data.  

PaigeMiller
Diamond | Level 26

You can use the DESCENDING option in the DEFINE statement.

--
Paige Miller
Ksharp
Super User
proc report data=sashelp.heart(obs=1000) nowd;
column status sex bp_status n ageatstart;
define status/group;
define sex/group;
define bp_status/group;
define ageatstart/group descending;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 432 views
  • 0 likes
  • 5 in conversation