Help using Base SAS procedures

Help required -Proc Import with csv file

Occasional Learner
Posts: 1

Help required -Proc Import with csv file


CSV file that I'm trying to read into SAS university edition contains 107 variables. The variable names start with var3 and end with var189 .

When I used the following code,

proc import datafile="/folders/myfolders/sample.csv" out=sample1

        dbms=csv replace; getnames=yes; ;


the variable names in the output data set change completely. The sequence of variable names start with var1 and ends with var189 but has 107 variables like the input CSV file.

I tested this using:

proc contents data=sample1;


I'm not sure as to why the variable names change. That is instead of var3 as the first variable name, it shows as var1.

Please help to understand the reason and I tried changing the input file format, but I still come across the same problem with the variable names.

The bottom line is whatever variable names displayed in the input file should appear in the output dataset also.

SAS Employee
Posts: 967

Re: Help required -Proc Import with csv file

In your csv file, are the variable names in the very first row? (or is there possibly a blank row in the file before the variable names?)


Super User
Posts: 17,868

Re: Help required -Proc Import with csv file

Can you post the first few lines of your file?
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation