SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ivethguzman
Calcite | Level 5

Hello, 

I have to use proc format to categorize a variable from my data set, the instructions are as follows:

If any student with High School Class Rank percentile less than 82 is categorized as hcrank and lcrank otherwise (use proc format to categorize).

 

My code: 

proc format;
value hsrank 'hcrank' max= '82'
	      other = 'lcrank';
		  	 
run;
/***/
data temp;
infile '/folders/myfolders/MY SAS Files/Data/finaldata.txt';
input ID gpa hsrank act year;
label ID = 'Identification'
	  gpa = 'Grade-point average following freshman year'
	  hsrank = 'High school class rank as percentile'
	  act = 'ACT entrence examination score'
	  year = 'Calender year that freshman entered university';
run;

followed by : 

  1. Find the 99% confidence interval for the proportion of lcrank.

since I can not run the first part, I can also not run the second part. 

For the second part should i address it as proc univariate ?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc format;
    value hsrank low-82='hcrank'
	      other = 'lcrank';	  	 
run;

For the second part, use PROC FREQ

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26
proc format;
    value hsrank low-82='hcrank'
	      other = 'lcrank';	  	 
run;

For the second part, use PROC FREQ

--
Paige Miller
ivethguzman
Calcite | Level 5

Hi PaigeMiller, 

I am still confused about proc freq.

I have tried :

proc freq data=final2;
tables hsrank;
format hsrack hcrank.;
run;

which gives the High school class rank as percentile

 

output:

Screen Shot 2019-12-16 at 4.54.51 PM.png

 

but can still not find the 99% confidence interval for the proportion of lcrank.

PaigeMiller
Diamond | Level 26

@ivethguzman wrote:

Hi PaigeMiller, 

I am still confused about proc freq.

I have tried :

proc freq data=final2;
tables hsrank;
format hsrack hcrank.;
run;

 

 


You don't have a format named hcrank. You have a format named hsrank (at least if you used the code I showed). You also don't have a variable named hsrack. So first you need to fix the spelling errors.

 

Next, there are many many many many useful options in PROC FREQ, the one you want is the BINOMIAL option of the TABLES statement. It would be a good idea for you to become familiar with them because I'm sure you will be using them a lot. Here they are: https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_freq_syntax08.htm&docsetVersion=1... 

--
Paige Miller

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 3 replies
  • 859 views
  • 1 like
  • 2 in conversation