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

I want to import a csv file with 90 variables (columns) and  >100K rows.  I want to assign row 3 as containing the variable names.  The data rows start on row 9.  How can I do this with Proc Import?

Thanks in advance...

Gene

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Easiest thing to do is delete rows 1 and 2 and delete rows 4-8.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Easiest thing to do is delete rows 1 and 2 and delete rows 4-8.

--
Paige Miller
genemroz
Quartz | Level 8
This turned out to be the easiest approach. Thanks to all for responding with suggestions.
ballardw
Super User

Did the source of that file provide an adequate contents description to write a data step? Such as column meaning, ranges of values, layout such as currency or dates, maximum length of character variables?

 

If so, I would write a data step and use the INFILE option Firstobs=9 to skip to the first line of the data wanted.

 

As a minimum you want to include a Guessingrows=max; statement if using proc import. Otherwise the number of rows examined may result in many mismatches of variable types or truncated values.

 

Regardless, you want to save the generated data step in the log as you may need to make changes that aren't possible directly with Proc Import and it is often easier to modify some working code (the generated data step) than to start from scratch.

Proc import will treat any series of digits only as a number. Which leads to loss of significant leading zeroes in thing like bank accounts or routing numbers and similar.

SASKiwi
PROC Star

If you delete row 2, GETNAMES = YES will work. Then specify DATAROWS = 8 to identify which row to starting read your data from, since you deleted a line.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 692 views
  • 0 likes
  • 4 in conversation