%let dirdata="C:\Users\jc3992\Downloads";
libname snow "&dirdata";
/*1*/
data snow.snowfall;
proc import "&dirdata.snow.sas7bdat";
run;
Hello everyone,
I changed to SAS 9.2 from University Edition because I could not read the full length of a data set by SAS Studio,
thus I am not familiar with setting a permanent library.
I used the code above to import a data set in a sas. file
and the LOG showed this:
77 %let dirdata="C:\Users\jc3992\Downloads"; 78 libname snow "&dirdata"; NOTE: Line generated by the macro variable "DIRDATA". 1 ""C:\Users\jc3992\Downloads" -- 49 - 22 -- 49 ERROR: Libref SNOW is not assigned. ERROR: Error in the LIBNAME statement. NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. ERROR 22-7: Invalid option name C. 79 /*1*/ 80 data snow.snowfall; ERROR: Libref SNOW is not assigned. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: PROCEDURE IMPORT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: The SAS System stopped processing this step because of errors. 81 proc import "&dirdata.snow.sas7bdat"; NOTE: Line generated by the macro variable "DIRDATA". 1 ""C:\Users\jc3992\Downloads"snow.sas7bdat -- 49 22 76 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. ERROR 22-322: Syntax error, expecting one of the following: ;, DATAFILE, DATATABLE, DBMS, DEBUG, FILE, OUT, REPLACE, TABLE, _DEBUG_. ERROR 76-322: Syntax error, statement will be ignored. 82 run;
May I ask how can I assign the libref snow?
Thank you!
remove the quotes:
%let dirdata=C:\Users\jc3992\Downloads;
It worked after I struggled the whole afternoon lol
Thanks so much!!
%let dirdata=C:\Users\jc3992\Downloads;
libname snow "&dirdata";
run;
/*1*/
data snow.snowfall;
set "&dirdata.Tmp4.Snow";
Year = INPUT((SUBSTR(Season, 1, length(Season)-3)),4.);
ARRAY month (10) Sep--Total;
DO i=1 to 10;
if month(i)=. then month(i)=0;
end;
run;
Now the data set is in the Tmp4 file in my dirdata file.
I want to create a graph of the snowfalls for November December January February and March v.s. Year
The part of the data set is as below
And after I ran the code,
the Log showed as below:
168 %let dirdata=C:\Users\jc3992\Downloads; 169 libname snow "&dirdata"; NOTE: Libref SNOW refers to the same physical library as TMP4. NOTE: Libref SNOW was successfully assigned as follows: Engine: V9 Physical Name: C:\Users\jc3992\Downloads 170 run; 171 %let dirdata=C:\Users\jc3992\Downloads; 172 libname snow "&dirdata"; NOTE: Libref SNOW refers to the same physical library as TMP4. NOTE: Libref SNOW was successfully assigned as follows: Engine: V9 Physical Name: C:\Users\jc3992\Downloads 173 run; 174 175 /*1*/ 176 data snow.snowfall; 177 set "&dirdata.Tmp4.Snow"; ERROR: Extension for physical file name "C:\Users\jc3992\DownloadsTmp4.Snow" does not correspond to a valid member type. 178 Year = INPUT((SUBSTR(Season, 1, length(Season)-3)),4.); 179 ARRAY month (10) Sep--Total; NOTE: The array month has the same name as a SAS-supplied or user-defined function. Parentheses following this name are treated as array references and not function references. ERROR: Variable Sep cannot be found on the list of previously defined variables. ERROR: Too few variables defined for the dimension(s) specified for the array month. 180 DO i=1 to 10; 181 if month(i)=. then month(i)=0; 182 end; 183 run; NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 178:22 178:40 NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 181:4 NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set SNOW.SNOWFALL may be incomplete. When this step was stopped there were 0 observations and 3 variables. WARNING: Data set SNOW.SNOWFALL was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
May I ask what did it mean by "a valid member type"?
And what can I do to "Array" command to make this work?
Any suggestions and hints would be much appreciated!
Thanks very much!
first off, this is wrong
data snow.snowfall; 177 set "&dirdata.Tmp4.Snow";
should be
data snow.snowfall; 177 set &dirdata..Tmp4;
The naming convention is libref.sasdatasetname
Your libref is snow, so it should be snow.datasetname
Thanks very much!
so,
I use my university desk top again to continue,
and I encountered problem again.
(for previous months I'have used Sas Studio because I use Mac
but I got some data sets not easily access so I changed to SAS 9.2
I really need some help..)
The same problem again.
It is:
%let dirdata=C:\Users\jc3992\MySASData;
libname snow "&dirdata";
run;
and the LOG is as below:
4 %let dirdata=C:\Users\jc3992\MySASData; 5 libname snow "&dirdata"; NOTE: Library SNOW does not exist. 6 run;
I have checked the folder,
it showed it does not exist.
Would you mind helping me out with this ?
I can hardly move on with these issues >"<
Thanks!!
Good morning, Give me an hour or so, I have just woken up, Let me get to my college lab and post you some clear demonstrations. I do not have sas at home I'm afraid.
I succeeded!^__^
Thanks for your kind help~~
May I ask you what command I can use if I am going to combine data to some categories.
For instance, I have a data set listing every single years, months in every year, and quantity of snowfall for each month in each year,
and now I am going to combine these to three columns named "Year" "Month" and "Snowfall"
What would you do with this?
Thank you!:)
You need to learn the sas concepts of combining datasets. It's not just about command or statement. It's about how you approach a solution with a concept,
https://www.albany.edu/~msz03/epi514/notes/p121_142.pdf
http://www-personal.umich.edu/~kwelch/b600/2012/Combining%20SAS%20Data%20Sets.pdf
When I want to merge the PISA data from 2015 I get the sign that 'Libref is not assigned'.
I don't know what I do wrong and tried a lot of things.
Can somebody here help me?
HI @FraukevdRijt Review your libname statement carefully. You will notice you missed to assign a libref after the keyword libname before the 'path'
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.