BookmarkSubscribeRSS Feed
ChuksManuel
Pyrite | Level 9

Hello forum,

 

I want to classify variables based off their responses - 0 to 9 into "A" , "B" and "C".

Especially, i want people with the "0" response that is less than 30% in the "C" category and people with "0" response between "30% -80%" in the "B" category and people with >80% in the C category.

Please how do i go about this.

Any help or idea is appreciated.

proc freq data=two;
table T1	T2	T3	T4; run;

Capture.JPG

4 REPLIES 4
mkeintz
PROC Star

How do you intend to represent the variable classification>  Will you produce three datasets (A,B, and C) with qualifying variables in each?  Do you just want a report table with each variable listed along with the classification?

 

Alsol, do any of your original variables ever have missing values?  If so, do the 30% and 80% cutpoints include counting the missing values, or not?

 

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ChuksManuel
Pyrite | Level 9

Thank you so much.

I hope them to be in 3 different datasets.

I am so confused on how to do that with proc freq.

Reeza
Super User

Are you classifying people/individual records or variables?

proc freq summarizes variables not individuals. 

plans what does I want people with 0 response that is less than 30% in the C and people with the 0 response in the 30 to 8 as B. 
how does one person have more than one response?


@ChuksManuel wrote:

Hello forum,

 

I want to classify variables based off their responses - 0 to 9 into "A" , "B" and "C".

Especially, i want people with the "0" response that is less than 30% in the "C" category and people with "0" response between "30% -80%" in the "B" category and people with >80% in the C category.

Please how do i go about this.

Any help or idea is appreciated.

proc freq data=two;
table T1	T2	T3	T4; run;

Capture.JPG


 

PaigeMiller
Diamond | Level 26

PROC FREQ produces only one data set. You could take the results of PROC FREQ and use them to help create other data sets, however, your stated rules are not clear and definitive enough to create code that winds up which creates these data sets. How can "0" less than 30% be in C, but other "0" between 30 and 80 be in "B"? How do we tell the "0" that are in C apart from "0" that wind up in "B". Explain this in much more detail, give us an example. 

--
Paige Miller

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!

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
  • 4 replies
  • 699 views
  • 0 likes
  • 4 in conversation