Hello,
I have been using SAS extensively over the last 2-3 months for research
I am trying to load these files - they give you the source code
https://www.hcup-us.ahrq.gov/db/nation/sasloadprog.jsp?year=2014&db=NIS
Let's take one example: https://www.hcup-us.ahrq.gov/db/nation/nis/tools/pgms/SASLoad_NIS_2014_Severity.SAS
I have had no problems with copy-pasting the provided code and sticking at the very top
LIBNAME NIS '/folders/myfolders/NIS';
Then replacing the *** Data Step to load the file *** line with
DATA nis.NIS_2014_Severity;
INFILE '/folders/myfolders/NIS/NIS_2014_Severity.ASC' LRECL = 81;
I loaded all of the Core files this way (the libname statement then modifying the Infile location), as well as about half of the severity files but all of a sudden my code gives me an error saying
Your situation is not clear.
I have looked at code written in:
https://www.hcup-us.ahrq.gov/db/nation/nis/tools/pgms/SASLoad_NIS_2014_Severity.SAS
it conains 2 steps:
1) proc format to run and create formats in work.library catalog.
2) a data step to create a data-set using statement:
INFILE 'NIS_2014_Severity.ASC' LRECL = 81;
you changed the data statement to have output to NIS library. That maybe OK.
But where is the input file? it is not a SAS data-set!
Do you work at home and '/folders/myfolders/...' are on your personal PC or
do you work on a class PC, then probably the NIS directory is already assigned and
prevented from writing in (and deleting from) by the students.
Do have your own directory/library that you are authorized to read-write-delete ?
thank you for your advice! I actually settled the problem by changing around file locations into a file location that worked.
I'm on a PC so i can make my own directory/library.
I unfortunately have a new problem though
After successfully loading the files, I ran the code
data nis.core_hospital;
merge
nis.Nis_2007_core
nis.Nis_2007_hospital
;
by HOSPID;
run;
^This bit works totally fine but when I run the following:
proc sort data = nis.core_hospital out = nis.core_hospital;
by KEY;
run;
I get
Have you previous sessions stopped unexpectedly?
If positive it could leave a lot of garbage in your work library.
You need clear it, try by next code:
proc datasets lib=work; delete _ALL_; run;
alternatively use OS commands.
Afterwords enter a new sas session and run your programs.
If you still have disk space issue you can use same code, deleting specific temporary files
not used any more, like in:
data temp1;
set have;
...
run;
data temp2; /* or any proc creating temp2 */
set temp1;
...
run;
/* no need temp1 any more - delete it */
proc datasets lib=work; delete temp1; run;
etc.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.