Hi, I am using SAS Enterprise guide and running below statements.i have created data set Voter then i created the formats.
Now,While running proc print,I am getting warning as:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc print data=voter;
74 var Age Party ques1-ques4;
75 format Age age.
76 Party $Party.
77 ques-ques4 $nodrt.
78 ;
WARNING: Variable QUES not found in data set WORK.VOTER.
79 run;
NOTE: There were 7 observations read from the data set WORK.VOTER.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.13 seconds
cpu time 0.13 seconds
80
81 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
94
This is my complete Code:
data voter;
input Age Party : $1. ques1$ ques2$ ques3$ ques4$;
datalines;
23 D 1 1 2 2
45 R 5 5 4 1
67 D 2 4 3 3
39 R 4 4 4 4
19 D 2 1 2 1
75 D 3 3 2 3
57 R 4 3 4 4
;
run;
proc format;
value Age
0-30='0 to 30'
31-50='31 to 50'
51-70='51 to 70'
71-100='71+';
value $Party
'D'='Democrat'
'R'='Republican';
value $nodrt
'1'='Strongly Disagree'
'2'='Disagree'
'3'='No Opinion'
'4'='Agree'
'5'='Strongly Agree';
run;
proc print data=voter;
var Age Party ques1-ques4;
format Age age.
Party $Party.
ques-ques4 $nodrt.
;
run;
Looking at the code you used to create the data set VOTER, there is no variable named QUES. If there is a variable named ques, show me where it is in the code creating VOTER.
WARNING: Variable QUES not found in data set WORK.VOTER.
This seems extremely clear to me. You do not have a variable named QUES
No.
Let me re frame the warning:
WARNING: Variable ques not found in data set WORK.VOTER.
While ques is there in voter data set.Everything is there still it is showing warning and not printing the values like:
value $nodrt
'1'='Strongly Disagree'
'2'='Disagree'
'3'='No Opinion'
'4'='Agree'
'5'='Strongly Agree';
run;
Looking at the code you used to create the data set VOTER, there is no variable named QUES. If there is a variable named ques, show me where it is in the code creating VOTER.
Thanks.silly mistake i have done.
I have written ques-ques4 whereas i should write ques1-ques4 that i have declared in voter data set.
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.