BookmarkSubscribeRSS Feed
Silver77
Calcite | Level 5

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

 

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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.

 

 

 

--
Paige Miller
Silver77
Calcite | Level 5
age-adjusted data is the variable in the table when I ran the proc contents

Full error

OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 proc sgplot data=cardata;
70 scatter x=Year y=Age_Adjusted_Rate;
ERROR: Variable AGE_ADJUSTED_RATE not found.
71 series x=Year y=Age_Adjusted_Rate;
ERROR: Variable AGE_ADJUSTED_RATE not found.
72 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 484.15k
OS Memory 23720.00k
Timestamp 07/31/2023 05:54:32 PM
Step Count 42 Switch Count 0
Page Faults 0
Page Reclaims 107
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
73
74
75 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
85
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Tom
Super User Tom
Super User

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: Call for Content

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!

Submit your idea!

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
  • 553 views
  • 0 likes
  • 3 in conversation