BookmarkSubscribeRSS Feed
bbb_NG
Fluorite | Level 6


Dear All,

I've written 2 patterns of code.(difference is the "*" before "getnames=no")

1.

proc import

datafile="&importpath\_20131224CMCVIPReview\datarequest.csv"

out=_20131224CMCVIPReview

dbms=csv

replace;

*getnames=no;

run;

2.

proc import

datafile="&importpath\_20131224CMCVIPReview\datarequest.csv"

out=_20131224CMCVIPReview

dbms=csv

replace;

getnames=no;

run;

The result for code 1 is all value within the CSV is "< Value not readable>"

The result for code 2 is the correct imports except the row 1 value and the column names are var1,etc.

Can anyone give a hand?

Thanks in advance.

Dawn

10 REPLIES 10
art297
Opal | Level 21

Can you post the first couple of lines of the csv file you are trying to import?

bbb_NG
Fluorite | Level 6

ResultOfCode1.pngResultOfCode2.pngArthur,

Thanks for your attention.

For better understanding I attached the 2 outputs of result for your reference.

The first is the output of code 1,the second is the output of code 2.

Thanks.

Dawn

bbb_NG
Fluorite | Level 6

Arthur,

Attached is some records from CSV file,which is "saved as" from a excel file.

CityBranchCustNameHubFalgUpgradeDateUpgradeDate_FormatHub_Format
上海GUBYICK POON MING 5.1现有 VIP2013/6/1CN06131
上海GUBWONG CHUI YIN5.1208现有 VIP###2013/6/1CNHA07345
NaveenSrinivasan
Calcite | Level 5

Hi,

I'd like to suggest you to read the csv file in the datastep infile and input. In my experience, I have encountered various issues whilst using Proc import. Presumably, datastep is perhaps more efficient too. Or, there is a possibility of saving your csv file as an xls file and use the import wizard. However, I would assume the dataset is much too large to fit in the xls file.

Datastep option is perhaps better in my opinion.

Thanks,

Naveen

art297
Opal | Level 21

I don't know what additional problems you might confront but, the sample you posted, appears to be tab delimited .. not csv.

Have you tried it with DBMS-tab   ?

Tom
Super User Tom
Super User

Sounds like you might be having an encoding issue with the characters that are in the text file.

bbb_NG
Fluorite | Level 6

Dear All,

Thanks for taking a look into my problem.

I will try datasetp with the suggestion of Naveen.

Thanks again for your knid help.

Dawn


jakarman
Barite | Level 11

I am seeing the special Eastern language characters once being indicated to be solved by a DBCS approach.

Web/Html and Microsoft office are using utf-8 these days. Most systems however are using latin-1 (western) single byte.

This is what Tom already mentioned as being an encoding problem. You cannot read all chars of utf-8 in a latin-1 only system.

When your SAS system is running latin-1  change it to run utf-8 (different menu lay-out) and import again.  

Be aware of the bom (byte order mark) can be added to files editted by a SAS utf-8 system possible making them unusable for programs not aware of utf-8 encoding.

---->-- ja karman --<-----
GadyKotler
Calcite | Level 5

Hi,

If your original data is stored in a XLSX file then you can use the new %xlsx2sas macro to transform it to SAS data set without going through CSV format.

The %xlsx2sas macro supports NLS encoding (UTF-8).

Demo download & free trial at: www.bixforsas.com

Trey
Fluorite | Level 6

See if the following works.

proc import

datafile="&importpath\_20131224CMCVIPReview\datarequest.csv"

out=_20131224CMCVIPReview

dbms=csv

replace;

getnames=yes;

datarow=2;

run;

OR

proc import

datafile="&importpath\_20131224CMCVIPReview\datarequest.csv"

out=_20131224CMCVIPReview

dbms=dlm

replace;

delimiter=",";

getnames=yes;

datarow=2;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 10 replies
  • 1746 views
  • 1 like
  • 7 in conversation