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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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