Hallo, I have some text files and I would like to import them in sas. But I only get one column instead of different column. Can someone please help me with this? I attach the text file here. Thanks.
Assuming you only want the first portion of the file :
filename myFile "&sasforum.\datasets\F-F_Research_Data_Factors.txt";
data test;
format dt yymmn6.;
label Mkt_RF="Mkt-RF";
infile myFile missover;
input @;
if anyalpha(_infile_) = 0 and length(trimn(_infile_)) > 0 then do;
input dttxt $ Mkt_RF SMB HML RF;
if length(trim(dttxt)) = 6 then do;
dt = input(dttxt, yymmn6.);
output;
end;
end;
drop dttxt;
run;
PG
Assuming you only want the first portion of the file :
filename myFile "&sasforum.\datasets\F-F_Research_Data_Factors.txt";
data test;
format dt yymmn6.;
label Mkt_RF="Mkt-RF";
infile myFile missover;
input @;
if anyalpha(_infile_) = 0 and length(trimn(_infile_)) > 0 then do;
input dttxt $ Mkt_RF SMB HML RF;
if length(trim(dttxt)) = 6 then do;
dt = input(dttxt, yymmn6.);
output;
end;
end;
drop dttxt;
run;
PG
Thank you!!
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.