BookmarkSubscribeRSS Feed
hpfw33
Calcite | Level 5

Hi  there,

 

That is my first question to the community!! 

 

So a variable called PARAMN is a numeric ordering variable for the PARAM variable in my dataset , only one PARAM corresponds to one PARAM . 

My question is how can I create one/two proc reports  which will generate an output including the following : 

 1) One output with three columns defined where PARAMN  IN ( 1 2 5 ). 

     Second output with two columns for PARAMN IN ( 3 4 ).

     These two outputs should be combined together.

 2) Sort the above output as per PARAMN ( 1 2 3 4 5) , i.e I want to see PARAMN = 3 comes after 2 AND not after 5 . 

 

Please any ideas will help . 

 

Thanks !! 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

I think we'd need to see the code you are using, and we also need to see a portion of the dataset you are using, and you need to show us the desired output(s).

--
Paige Miller
NadiaKing_01
Calcite | Level 5
An exemple would definitely help, but ,with your explanation, I would work with the option display and creating variable using _c_.
Cynthia_sas
SAS Super FREQ
Hi:
I don't understand why you need 2 PROC REPORTS for this, especially if the ultimate result is to see the PARAMN in numeric order. Definitely seeing data and code you've tried and/or an example of the desired result will be useful. No one can make a constructive suggestion based on your information. For example, the suggestion to use absolute column numbers would be useful only if your code uses ACROSS variables.
Cynthia
Reeza
Super User
1. Create a new variable that is ordered in the levels the way you want. For example, map 1, 2,5 to 1,2,3 and then map 3,4 to 4, 5
2. For the third variable you're not interested in for the second group, consider setting those values to missing?
3. Use PROC REPORT to display the data.

If you need further assistance please post data and code. If your data is confidential or you cannot post it, use SASHELP.CLASS data set and make your ages equivalent to PARAMN.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 640 views
  • 2 likes
  • 5 in conversation