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

Dear Everyone, 

 

I am importing text file to SAS format. I want to use first row as name and start the data from third row. I am using the following code. It is not happening:

 

proc import datafile='H:\Seminar Class\Banking Seminar\Data by me\Bank Call Report\FFIEC data\FFIEC CDR Call Bulk All Schedules 03312011/FFIEC CDR Call Bulk POR 03312011.txt'
out=POR0311 dbms=dlm replace;
datarow=2; delimiter='09'x;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@nazmul

If you want to read the data starting in row 3 then instruct SAS to do so by setting datarow=3

proc import datafile='c:\temp\test.txt'
  out=POR0311 
  dbms=dlm replace;
  datarow=3
  ;
  delimiter='09'x;
  getnames=yes;
  guessingrows=max;
run;

If Proc Import can't fully do what you need then you can also always copy/paste the generated data step from the log into a code window and then amend this data step as you need it. This gives you full flexibility.

View solution in original post

4 REPLIES 4
pau13rown
Lapis Lazuli | Level 10

it says 'datarow=2', but you want to start at row 3. Usually it is not recommended to modify the data source but why not just remove the 2nd row from the txt file and run the code again?

Patrick
Opal | Level 21

@nazmul

If you want to read the data starting in row 3 then instruct SAS to do so by setting datarow=3

proc import datafile='c:\temp\test.txt'
  out=POR0311 
  dbms=dlm replace;
  datarow=3
  ;
  delimiter='09'x;
  getnames=yes;
  guessingrows=max;
run;

If Proc Import can't fully do what you need then you can also always copy/paste the generated data step from the log into a code window and then amend this data step as you need it. This gives you full flexibility.

nazmul
Quartz | Level 8
Thank you Patrick. Your code was really helpful for me 😄

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

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
  • 4 replies
  • 1634 views
  • 0 likes
  • 4 in conversation