DATA Step, Macro, Functions and more

Delimited file and variables of Interest

Reply
Super Contributor
Posts: 648

Delimited file and variables of Interest

I have a pipe (|) delimited file and it doesnt have variable names.There are twenty columns.How can I read just a few say for instance column1, column7, cloum11?

SAS Employee
Posts: 26

Re: Delimited file and variables of Interest

You can use PROC IMPORT  to read all the variables, then KEEP the ones you want.

PROC IMPORT OUT= WORK.test   /* your SAS data set */

            DATAFILE= "C:\temp\test.csv"   /* replace with your input data set name */

            DBMS=CSV REPLACE;

     GETNAMES=NO;

     DATAROW=1;

RUN;

data test;

  set test (keep=var1 var7 var11);

run;

VAR is the default variable name prefix when the first row is not variable names.

Jan

Ask a Question
Discussion stats
  • 1 reply
  • 129 views
  • 0 likes
  • 2 in conversation