Help using Base SAS procedures

IMPORT PROBLEM

Reply
Contributor
Posts: 21

IMPORT PROBLEM

Hi when i import a large file to SAS it replaces some of the variables with 1,2 , 3, etc. upto 9. I would like the original vaues ie: 1222, 6335, 3245 to remain as they are.

How do I ensure the SAS does not alter my variables?

The current command I am using is:

PROC IMPORT OUT= WORK.accounting          

DATAFILE= "C:\Users\253507F\Desktop\accvariables.csv"           

DBMS=CSV REPLACE;     GETNAMES=YES;     DATAROW=2; RUN;

Contributor
Posts: 60

Re: IMPORT PROBLEM

I have experienced a similar problem when uploading CSV files! Very interested to hear problems to solve for this

Super User
Posts: 10,023

Re: IMPORT PROBLEM

I don't understand what you mean ?

I notice you used DBMS=CSV ,that means SAS will take comma as a delimiter , and data 1222, 6335, 3245 contains comma , Maybe SAS take it as a delimiter .

So try to use DBMS=dlm ;   delimiter='your-delimiter' ;

Ksharp

Contributor
Posts: 21

Re: IMPORT PROBLEM

ratioratio after import
0.0000180621
-0.0000158752
0.0000043383
-0.000132
0.0003161
-0.0000056841
-0.0001732
-0.000060281

This is what I mean. The actual values are translated into digits between 1-9.

I used DBMS=dlm ;   delimiter='your-delimiter' ; and this does not provide me with my table. Rather than having 18 rows by 23 columns, my table 2 columns with many rows via your method.

Super User
Posts: 10,023

Re: IMPORT PROBLEM

It is hard to say something.

Can you post some sample file of yours . I can test it whether it is right.

Super User
Posts: 11,343

Re: IMPORT PROBLEM

When you run your example IMPORT code there should be datastep code in the log. If you would provide that we can probably provide better help. I suspect that the culprit will turn out to be the default GUESSINGROWS value of 20. If the first 20 rows have values that are integers the import procedure will assume the others are.

Try adding guesssingrows=32767 (this is the largest number of rows SAS will examine for CSV to determine range and types of values)

Ask a Question
Discussion stats
  • 5 replies
  • 243 views
  • 1 like
  • 4 in conversation