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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

WARNING: Variable QUES not found in data set WORK.VOTER.

 

This seems extremely clear to me. You do not have a variable named QUES

--
Paige Miller
Mohit2105
Calcite | Level 5

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;

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Mohit2105
Calcite | Level 5

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 865 views
  • 0 likes
  • 2 in conversation