SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 911 views
  • 0 likes
  • 5 in conversation