BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Lilly1FAMU
Calcite | Level 5
How do I fix the file error? 
 
 
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 data SAS2023.YRBS1;
70 set SAS2023.YRBS2017;
ERROR: File SAS2023.YRBS2017.DATA does not exist.
71 keep q1-q5 q23-q29;
72 run;
 
WARNING: Not all variables in the list q1-q5 were found.
WARNING: Not all variables in the list q23-q29 were found.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set SAS2023.YRBS1 may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set SAS2023.YRBS1 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 560.96k
OS Memory 20896.00k
Timestamp 10/07/2023 07:36:00 PM
Step Count 24 Switch Count 0
Page Faults 0
Page Reclaims 47
Page Swaps 0
Voluntary Context Switches 26
Involuntary Context Switches 0
Block Input Operations 32
Block Output Operations 8
 
 
 
73
74 proc contents data=SAS2023.YRBS1; run;
 
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.02 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 1668.96k
OS Memory 21924.00k
Timestamp 10/07/2023 07:36:00 PM
Step Count 25 Switch Count 0
Page Faults 0
Page Reclaims 557
Page Swaps 0
Voluntary Context Switches 7
Involuntary Context Switches 0
Block Input Operations 152
Block Output Operations 16
 
 
75
76 proc format;
77 value $age '1'= '12 years old or younger' '2' = '13 years old' '3' = '14 years old' '4' = '15 years old' '5' = '16 years
77 ! old' '6' = '17 years old' '7' = '18 years old';
NOTE: Format $AGE has been output.
78 value $sex '1'= 'Female' '2' = 'Male';
NOTE: Format $SEX has been output.
79 value $grade '1'= '9th grade' '2'= '10th grade' '3'= '11th grade' '4' = '12th grade' '5'= 'Ungraded or other';
NOTE: Format $GRADE has been output.
80 value $hispanic/latino '1'= 'Yes' '2' = 'No';
NOTE: Format $HISPANIC has been output.
81 value $race '1' = 'American Indian or Alaska Native' '2'= 'Asian' '3'= 'Black' '4'= 'Native Hawaiian or Pacific Islander'
81 ! '5' = 'White';
NOTE: Format $RACE has been output.
82 value $bullying at school '1'= 'Yes' '2' = 'No';
NOTE: Format $BULLYING has been output.
83 value $electronic bullying '1'= 'Yes' '2' = 'No';
NOTE: Format $ELECTRONIC has been output.
84 value $sad or hopeless '1'= 'Yes' '2' = 'No';
NOTE: Format $SAD has been output.
85 value $considered suicide '1'= 'Yes' '2' = 'No';
NOTE: Format $CONSIDERED has been output.
86 value $made a suicide plan '1'= 'Yes' '2' = 'No';
NOTE: Format $MADE has been output.
87 value $attempted suicide '1' = '0 times' '2'= '1 time' '3'= '2 or 3 times' '4'= '4 or 5 times' '5' = '6 or more times';
NOTE: Format $ATTEMPTED has been output.
88 value $injurious suicide '1'= 'Did not' '2' = 'Yes' '3' = 'No';
NOTE: Format $INJURIOUS has been output.
89 run;
 
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 321.06k
OS Memory 21664.00k
Timestamp 10/07/2023 07:36:00 PM
Step Count 26 Switch Count 2
Page Faults 0
Page Reclaims 75
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 80
 
 
90
91 proc freq data=SAS2023.YRBS1;
92 table q1 q2 q3 q4 q5 q23 q24 q25 q26 q27 q28 q29;
ERROR: Variable Q1 not found.
ERROR: Variable Q2 not found.
ERROR: Variable Q3 not found.
ERROR: Variable Q4 not found.
ERROR: Variable Q5 not found.
ERROR: Variable Q23 not found.
ERROR: Variable Q24 not found.
ERROR: Variable Q25 not found.
ERROR: Variable Q26 not found.
ERROR: Variable Q27 not found.
ERROR: Variable Q28 not found.
ERROR: Variable Q29 not found.
93 format q1 $age. q2 $sex. q3 $grade. q4 $hispanicorlatino. q5 $race. q23 $bullingatschool. q24 $electronicbullying. q25
93 ! $sadorhopeless. q26 $consideredsuicide. q27 $madeasuicideplan. q28 $attemptedsuicide. q29 $injurioussuicideattempt.;
94 run;
 
NOTE: The SAS System stopped processing this step because of errors.
1 ACCEPTED SOLUTION
5 REPLIES 5
Lilly1FAMU
Calcite | Level 5

I uploaded the file from my canvas. But it is giving me the error because it does not recognize the file. How do I determine what the library name is? 

Here is my code

data SAS2023.YRBS1;
set SAS2023.YRBS2017;
keep q1-q5 q23-q29;
run;

proc contents data=SAS2023.YRBS1; run;

proc format;
value $age '1'= '12 years old or younger' '2' = '13 years old' '3' = '14 years old' '4' = '15 years old' '5' = '16 years old' '6' = '17 years old' '7' = '18 years old';
value $sex '1'= 'Female' '2' = 'Male';

 

 

Kurt_Bremser
Super User

For SAS to be able to work with the file, it should be named

yrbs2017.sas7bdat

All lowercase!

 

Or are you trying to use an Excel file with spreadsheets?

Lilly1FAMU
Calcite | Level 5

I uploaded the file from my canvas. But it is giving me the error because it does not recognize the file. How do I determine what the library name is? 

Here is my code

data SAS2023.YRBS1;
set SAS2023.YRBS2017;
keep q1-q5 q23-q29;
run;

proc contents data=SAS2023.YRBS1; run;

proc format;
value $age '1'= '12 years old or younger' '2' = '13 years old' '3' = '14 years old' '4' = '15 years old' '5' = '16 years old' '6' = '17 years old' '7' = '18 years old';
value $sex '1'= 'Female' '2' = 'Male';

 

Tom
Super User Tom
Super User

The LIBREF you need to use depends on the LIBNAME statement you submitted.

 

In your code you are using the LIBREF of SAS2023.  So you need to have submitted a LIBNAME statement that defines SAS2023 to point to the directory (what some might call a "folder") where you uploaded the file.  So something like:

libname sas2023 "~/homework";

If you are running SAS on a Unix machine then make sure the name of the file you uploaded is exactly yrbs2017.sas7bdat since Unix filenames are case sensitive and SAS will be looking for a name using only lowercase letters.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 725 views
  • 0 likes
  • 3 in conversation