BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
thdang
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

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

PG
thdang
Calcite | Level 5

Thank you!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 706 views
  • 0 likes
  • 2 in conversation