Help using Base SAS procedures

Importing data

Occasional Contributor
Posts: 15

Importing data

I have .CSV file with 2000 columns.Some columns have blank data.Now mr requirement is:

(1)How to import this file into SAS,while importing into SAS i need to drop the columns with blank data?

(2)How to import only column1,column2,column150,column256?

Super User
Posts: 23,663

Re: Importing data

You ou need to import all and drop the columns you don't want in a second step.

Super User
Posts: 13,498

Re: Importing data


Use proc import. The procedure will generate a datastep to read the data. You can either Recall the code into the editor (F4 key by default, command Recall, or copy and paste from the log).

Edit the data step to have (keep= <list the names of the variables you want to keep>) data set option .

data want (keep=column1 column2 column150 column256);

<remainder of generated code>

If you can get you data in fixed column then you can read directly by specifying the columns to read.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation