BookmarkSubscribeRSS Feed
Hello_there
Lapis Lazuli | Level 10

Hi, i'm trying to sort sort in descending freq of soc_term, and pt_term within soc_term, and then do alphabetical for ties for each level. i have included a data set.

This is what the data looks like:

soc_term	pt_term	aesevn	count
infestation	overall	0	3 (15.0)
infestation	overall	1	2
infestation	overall	2	1
infestation	overall	3	0
infestation	cough	0	2 (10.0)
infestation	cough	1	1
infestation	cough	2	1
infestation	cough	3	0
infestation	fever	0	1 (5.0)
infestation 	fever	1	1
infestation 	fever	2	0
infestation	fever	3	0
infestation	sweats	0	0
infestation	sweats	1	0
infestation	sweats	2	0
infestation	sweats	3	0
bodiy injury	overall	0	5 (25.0)
bodily injury	overall	1	1
bodily injury	overall	2	0
bodily injury	overall	3	3
bodily injury	laceration	0	2 (10.0)
bodily injury	laceration	1	1
bodily injury	laceration	2	0
bodily injury	laceration	3	1
bodily injury	contusion	0	3 (15.0)
bodily injury	contusion	1	0
bodily injury	contusion	2	0
bodily injury	contusion	3	2
chronic pain	overall	0	5 (25.0)
chronic pain	overall	1	2
chronic pain	overall	2	2
chronic pain	overall	3	1
chronic pain	back	0	3
chronic pain	back 	1	2
chronic pain	back	2	1
chronic pain	back	3	0
chronic pain	neck	0	2
chronic pain	neck 	1	0
chronic pain	neck	2	1
chronic pain	neck	3	1

aesevn represents both an overall variable and severity level.

0= total number of subjects per soc_term, pt_term

1=mild

2=moderate

3= severe

 

I'm having a hard time keeping all the groups together when i try to sort. Does anybody have a solution?

 

thanks in advance

 

proc import datafile = "your import path" 
DBMS = xlsx out = have1 replace ;
run;
2 REPLIES 2
PaigeMiller
Diamond | Level 26

i'm trying to sort sort in descending freq of soc_term, and pt_term within soc_term, and then do alphabetical for ties for each level. i have included a data set.

 

Show us the desired output. I'm not sure I understand from the words exactly what you want.

 

Also, many of us will not download Excel files, as these can be security threats. The proper way to provide data is via working SAS data step code.

--
Paige Miller
Hello_there
Lapis Lazuli | Level 10

Thanks, PaigeMiller, for your response. I will keep that in mind in the future for when i present data. I figured since it was large, i mind as well attach it as an excel sheet.

I have figured a solution for my issue, so i know longer need help with this.

 

Thanks

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 1178 views
  • 2 likes
  • 2 in conversation