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"
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!
What have you tried so far?
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!
Many Thanks 🙂
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.