Date: Thu, 29 Jan 2009 06:19:30 -0500
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject: Re: Import CSV file to SAS
Content-Type: text/plain; charset="US-ASCII"
The code in the reply below will not work for several reasons so I have
adjusted it a bit:
infile CARDS /* i just put the data here for convenience */
dlm=',' dsd missover;
informat ClientName $50. Protocol $ 8. shortname $ 8.;
input ClientName Protocol ShortName StatusID StudyID ;
ABC co ltd,ABC-3001,ABC3001,3,2314
DEF , D 123, D123, 4, 2256
There should not be commas in the input statement (This was the result, I
assume, of cutting and pasting)
The length followed the input statement but by that time, the SAS
supervisor had already set protocol and shortname to be numeric variables
since there was no other information. I changed this to an informat and
placed it before the input statement.
Now, in these 100 CSVs, are there always the same variables and are they in
the same order?
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Re: Import CSV file to SAS
Please respond to
On Jan 29, 8:05 am, "sukumarbalusw...@gmail.com"
> I'm having 100 CSV files.with the following 5 columns.
> Please help me how to import these, The first row is not important for
> me. I want to have the second row as a "Variable Name" in SAS Data
> Set. And my data starts from the 3rd row.
> eg of one CSV file.
> ABC co ltd,ABC-3001,ABC3001,3,2314
> DEF , D 123, D123, 4, 2256
> Thanks in advcance.
Please use the following code
infile 'C:\Documents and Settings\mp31795\Desktop\model.csv'
dlm=',' dsd missover;
input ClientName $ ,Protocol,ShortName;
length ClientName $50. Protocol 8. shortname 8.;
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and/or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.