This is for a class with a set of data provided
I run this and the data works out just fine
filename refile'/home/u63360582/sas_datasets/cardata.csv';
proc import datafile=refile
DBMS=CSV
out=cardata
replace;
run;
The professor then asks to run
/*Makeascatterplotofratebyyear,andconnectthepoints*/
proc sgplot data=cardata;
scatter x=Year y=Age_Adjusted_Rate;
series x=Year y=Age_Adjusted_Rate;
run;
it keeps saying that Age adjusted rate can't be found
From now on, when there is an error in the log, please show us the ENTIRE log for this step (PROC or DATA step), not just the error messages. Do not paraphrase the error message. Do not show us partial or edited logs.
it keeps saying that Age adjusted rate can't be found
Probably the variable named Age_Adjusted_Rate is not in the data set named CARDATA. Perhaps you have spelled it wrong, or you have the wrong name, or it just simply isn't there for other reasons. You can run PROC CONTENTS on data set CARDATA and see what the actual variable names really are.
Show us a screen capture of the PROC CONTENTS output. Use the "Insert Photos" icon to include your screen capture in your reply. Do not attach files.
So the variable either is not in that dataset. Or perhaps you have used the wrong name.
Age_Adjusted_Rate is a different variable than 'Age adjusted rate'n or 'age-adjusted data'n.
Perhaps you have accidentally set the VALIDVARNAME option to ANY?
Try changing it to V7 before running the PROC IMPORT. That way PROC IMPORT should make a variable named Age_Adjusted_Rate from a column in the CSV file that has Age Adjusted Rate as the column header instead of making a variable name that has spaces in it so that it requires using name literals in the SAS code.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.