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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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