hypertension exists. SAS Studio can't find it? WHy?
libname mylib '/home/u50158717/Stat.775.data';
filename hyperten 'hypertension.txt';
data hp;
infile "mylib.hyperten" DLM='09'X DSD TRUNCOVER;
input group $ NaCl;
run;
error messge in log
You need to include the complete path to the file in the filename statement. If you see the file in your file list, right-click and check the Properties, and copy the path from there, then add to your code:
filename hyper '/u/myfolder/hypertension.txt';
Then use the fileref in your INFILE:
infile hyper DLM='09'X DSD TRUNCOVER;
You need to include the complete path to the file in the filename statement. If you see the file in your file list, right-click and check the Properties, and copy the path from there, then add to your code:
filename hyper '/u/myfolder/hypertension.txt';
Then use the fileref in your INFILE:
infile hyper DLM='09'X DSD TRUNCOVER;
So your code has a LIBNAME statement and a FILENAME statement at the top, but your data step is not using either the libref (MYLIB) or the fileref (HYPERTEN) they defined. Instead you are looking for a file named 'mylib.hyperten' in the current working directory.
If you want to use the libref then use it in specifying the output dataset name in the DATA statement.
data mylib.hp;
If you want to use the fileref then either point it to the actual file you want and then reference the fileref in your INFILE statement. So perhaps something like:
filename hyperten '/home/u50158717/Stat.775.data/hypertension.txt';
....
infile hyperten DLM='09'X DSD TRUNCOVER;
Or you could point the fileref to a folder and then name the specific file from that folder in the INFILE statement.
filename hyperten '/home/u50158717/Stat.775.data/';
....
infile hyperten('hypertension.txt') DLM='09'X DSD TRUNCOVER;
Or skip the FILENAME statement completely and just list the full filename in the INFILE statement.
infile '/home/u50158717/Stat.775.data/hypertension.txt' DLM='09'X DSD TRUNCOVER;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.