BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jay23
Fluorite | Level 6

Hi,

 

I am new to SAS and have just started by learning journey. I am not able to understand the below question I am given in my class.

Can someone please explain me and also guide me what is to be done in this.

 

The data to be used is Sashelp. Demographics.

 

"Create an indicator for adult literacy rate percentage with cutoff points at 90% and 50%. Then create a table report to show total population, average population annual growth rate percentage and average population in urban areas percentage for each region and your indicator level"

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Welcome to SAS. As others have said, it is always a good idea to work with classmates and teachers because they will help you to relate the assignment to topics you have covered in the course.

 

The part that is probably stumping you is "how do I create an indicator variable." Recall that an indicator variable is a categorical variable. You can show the levels to be numeric (., 1, 2, 3) or character (" ", "Low", "Medium", "High").  The following code gives you a hint on one way to create an indicator variable for these data:

 

data Want;
length LiteracyIndicator $6;
set Sashelp.Demographics;
if AdultLiteracypct = . then 
   LiteracyIndicator = " ";
else if 0 <= AdultLiteracypct < 0.5 then 
   LiteracyIndicator  = "Low";
else if 0.5 <= AdultLiteracypct < 0.9 then 
   LiteracyIndicator = "Medium";
else 
   LiteracyIndicator = "High";
run;

Now that you have an indicator variable, how can you create the report? I let you ponder that question!

 

Incidentally, this problem can be solved without explicitly creating an indicator variable by using a concept known as "SAS formats."  Ask your teacher about them!

View solution in original post

6 REPLIES 6
LinusH
Tourmaline | Level 20
1. What part of the don't you understand?
2. Class specific questions are best answered in your class, not here.
Data never sleeps
Jay23
Fluorite | Level 6
Thank you
Jay23
Fluorite | Level 6
For your encouragement
Rick_SAS
SAS Super FREQ

Welcome to SAS. As others have said, it is always a good idea to work with classmates and teachers because they will help you to relate the assignment to topics you have covered in the course.

 

The part that is probably stumping you is "how do I create an indicator variable." Recall that an indicator variable is a categorical variable. You can show the levels to be numeric (., 1, 2, 3) or character (" ", "Low", "Medium", "High").  The following code gives you a hint on one way to create an indicator variable for these data:

 

data Want;
length LiteracyIndicator $6;
set Sashelp.Demographics;
if AdultLiteracypct = . then 
   LiteracyIndicator = " ";
else if 0 <= AdultLiteracypct < 0.5 then 
   LiteracyIndicator  = "Low";
else if 0.5 <= AdultLiteracypct < 0.9 then 
   LiteracyIndicator = "Medium";
else 
   LiteracyIndicator = "High";
run;

Now that you have an indicator variable, how can you create the report? I let you ponder that question!

 

Incidentally, this problem can be solved without explicitly creating an indicator variable by using a concept known as "SAS formats."  Ask your teacher about them!

Jay23
Fluorite | Level 6

Many Thanks 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 888 views
  • 2 likes
  • 4 in conversation