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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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