I tried to create the data set below, however, I could only read 3 records intead of all of the 7 records. I am wondering what is wrong. Thank you very much !
data med_search;
input med $ 100 ;
datalines;
omeprazole (Prilosec, Prilosec OTC)
dexlansoprazole (Dexilent, Kapidex)
rabeprazole (Aciphex)
pantoprazole (Protonix)
Esomeprazole (Nexium)
Lansoprazole (Prevacid)
Zegerid (omeprazole with sodium bicarbonate)
;
run;
Hi @Ivy,
There are two issues:
One possible solution is to use list input with the "&" modifier, without which SAS would stop reading a line at the first blank (i.e. read only the first "word"):
input med &$100.;
SAS would now read until the first double blank or the end of the data line, whichever comes first. Hence, you might lose portions of the drug names if double blanks occurred. Therefore, a more robust approach would be to use formatted input in conjunction with the TRUNCOVER option of the INFILE statement (which needs to be inserted in order to specify this option). Without TRUNCOVER, the default option would be FLOWOVER with the unwanted effect described in item 2 above.
infile datalines truncover;
input med $100.;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.