sas >> CSV format importing problem, thank you!

by Nancy » Tue, 30 Jun 2009 02:12:58 GMT

In the CSV file, there is a variable named Zip, which includs number
values such as 32310 and character value such as 32310-2345.

When i tried to import the file, there was always error message for
the value 32310-2345. How I can treat the variable as character value
during importing?

Thank you very much!

sas >> CSV format importing problem, thank you!

by Nathaniel.Wooding » Tue, 30 Jun 2009 02:17:54 GMT


Nancy

Without seeing the actual input statement and error message, I can only
guess but I suspect that you are reading Zip as a numeric field and SAS
will get very upset if it sees a hypen in a numeric field. I would read it
as a character field.

Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Cel Phone: 804-205-0752



Nancy
<nancy0318@GMAIL.
COM> To
Sent by: "SAS(r) XXXX@XXXXX.COM
Discussion" cc
< XXXX@XXXXX.COM
GA.EDU> Subject
CSV format importing problem, thank
you!
06/29/2009 02:12
PM


Please respond to
Nancy
<nancy0318@GMAIL.
COM>






In the CSV file, there is a variable named Zip, which includs number
values such as 32310 and character value such as 32310-2345.

When i tried to import the file, there was always error message for
the value 32310-2345. How I can treat the variable as character value
during importing?

Thank you very much!


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.

sas >> CSV format importing problem, thank you!

by Nancy » Tue, 30 Jun 2009 03:19:14 GMT


Thank you so much, Nat.

How I can change the following code in SAS to read Zip as Charater
filed?

The code I used is:

PROC IMPORT OUT= outfile
DATAFILE= "infile"
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;

RUN;

Thanks again!












> gt;ancy
> na>cy0318@GMAI>.
> OM> gt;To
> > ent by: "SAS(r) A...@LISTSERV>UGA.EDU
> i>cussion" gt;gt;c
> XXXX@XXXXX.COM
> gt;A.EDU> > > Subject
> > gt;gt;SV format >mporting problem, thank
>>> gt;> ou!
> 6/29/2009 02:12
> >PM
>
> lease respond to
> a>cy> > nancy0318@GMAIL.
> OM>
>
> In t>e CSV file, there is a variable named Zip, which includs number
> values>such as 32310 nd c>ar>cter value such as 3231>-2>45.
>
> When i tried to import the file, here was always>error message for
> the value 32310-2345. ow I can treat the variab>e as character value
> during importing?
>
> Thank you very much!
> CONFIDENTIALITY NOTICE: his 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 additiona>
> express written confirmation to that effect. he information >s
> intended solely for the individual or entity named above and acce>s
> by anyone else is unauthorized. f you are not the intended >> recipient, any disclosure, copying, distribution, or use of the
> >ontents of this information is prohibited and may be unlawful. f

sas >> CSV format importing problem, thank you!

by Nathaniel.Wooding » Tue, 30 Jun 2009 03:26:24 GMT

ancy

I usually write my own imput statements so I don't use Import. If this is a
one-time occurance, you can edit the file and put a dummy record in front
of line 2. Put a zip + 5 type zip code in the zip column and SAS will read
it as a character value.

Nat

Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Cel Phone: 804-205-0752



Nancy
<nancy0318@GMAIL.
COM> To
Sent by: "SAS(r) XXXX@XXXXX.COM
Discussion" cc
< XXXX@XXXXX.COM
GA.EDU> Subject
Re: CSV format importing problem,
thank you!
06/29/2009 03:19
PM


Please respond to
Nancy
<nancy0318@GMAIL.
COM>






Thank you so much, Nat.

How I can change the following code in SAS to read Zip as Charater
filed?

The code I used is:

PROC IMPORT OUT= outfile
DATAFILE= "infile"
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;

RUN;

Thanks again!











On Jun 29, 2:17 pm, XXXX@XXXXX.COM (Nat Wooding) wrote:
it
To
cc
Subject
thank


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.

sas >> CSV format importing problem, thank you!

by Nancy » Tue, 30 Jun 2009 04:07:07 GMT

hanks!!


On Jun 29, 3:26m, XXXX@XXXXX.COM (Nat Wooding) wrote:
> gt;ancy
> na>cy0318@GMAI>.
> OM> gt;To
> > ent by: "SAS(r) A...@LISTSERV>UGA.EDU
> i>cussion" gt;gt;c
> XXXX@XXXXX.COM
> gt;A.EDU> > Su>ject
> > gt;gt;e: CSV format >mporting problem,
> gt;> gt;> hank you!
> > gt;6/29/2009 03:19
> M
>
> leas> respond >o >> >nc>
> nancy0318>GMAIL.
> gt;OM>
>
> Thank you so m>ch, Nat.
>
> How I ca> change the following >od> in SAS>to>read Zip as Char>te>
> filed?
>
> The code I used is:
>
> PROC IMPORT OUT= outfile
> DBMS=CSV REPLACE;
> ETNAMES=YES;
> > > ATAROW=2;
>
> RUN;
>
> Thanks again!
>
> On Jun 29, 2:17 pm, >a> XXXX@XXXXX.COM (Nat Wooding) wrote:
>
>
>
>
>
> > Nancy
>
>>> Wit>o>t seeing the actual inpu> s>a>ement and rr>r>message, I can only
> > guess >u> I suspect that you are reading Zi> >s a numeric field and>S>S
> > will get very >p>et if it sees a hypen in a numeric field> >I would read
> it
> > as a c>ar>c>er field.
>
>>>>Nat Wooding
> > Environme>t>l Specialis> I>I
> > >ominion, Environmental Biology
> > 4111 Castlewood Rd> > > >h>ne:804-271-5313, Fax: 804->7>-2977
> > gt;>Cel Phone:>8>4-205-0752
>
> > ancy
> > gt;nanc>0>18@GMAIL.
> > >C>M>
> To
> > gt;gt;ent by: "SAS>r)>gt;XXXX@XXXXX.COM >U> > > gt;i>cussion"
> cc
> > > > SA...@LIS>SE>V.> >> > A.EDU>
> Subject
> > > > SV format importing problem,
> thank
> > > gt;gt;ou!
> > 6/29/2009 02:12
> > gt;gt;M
>
> > lease respond to
> > anc> >> > na>cy>3>8@GMAIL.
> > gt;> > OM>
>
> > In the CSV file, there is a variable named >i>, which includs number
> > values such as 32310 nd character value >u>h as 32310-2345.
>
> > When i tried to import the file, here was a>w>ys error message for
> > the value 32310-2345. ow I can treat>t>e variable as character value
> > during importing?
>
> > Thank >o> very much!
>
> > CONFIDENTIALITY NOTICE: his electronic message c>n>ains
> > information which may be legally confidential and or >r>vileged and
> > does not in any case represent a firm ENERGY COMM>D>TY bid or offer
> > relating thereto which binds the sender without a> >dditional
> > express written confirmation to that effect. he i>f>rmation is
> > intended solely for the individual or entity named ab>v> and access
> > by anyone else is unau>ho>ized. f you are not the intended
> > recipient, any discl>sure, copying, distribution, or use of the
> > contents of this infor>ation is prohibited and may be unlawful. f
> > you have received th>s electronic transmission in error, please
> > reply immediatel> to the sender that you have received the message
> > in error, an> delete it. hank you.
>
> CONFIDENTIALITY NOTICE: his electronic>message contains
> information which may be legally confidenti>l and or privileged and
> does not in any case represent a firm E>ERGY COMMODITY bid or offer
> relating thereto which binds the sender>without an additional
> express written confirmation to that effe>t. he information is
> intended solely for the individual or entit> named above and access
> by anyone else is unauthorized.

sas >> CSV format importing problem, thank you!

by cdenney » Tue, 30 Jun 2009 06:58:01 GMT

ore help (from SAS Help) with the guessingrows option in Proc Export:

Number of rows to guess

The Import Wizard reads the number of rows specified to determine if
a column in a table is a character type or numeric type column. If
the majority of columns contain numeric data, SAS determines that the
column is numeric. If a majority of character data is found, SAS
determines that the column is a character column.

Note: This option corresponds to the guessingrowsS= option
statement in PROC IMPORT.



PROC IMPORT OUT= outfile
DATAFILE= "infile"
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;
Guessingrows=20000;
RUN;







At 03:07 PM 6/29/2009, Nancy wrote:


Carl Denney, MSIE
Founder
Health InfoTechnics
210 Jamestown Park, Suite 101, Brentwood, TN 37027
615/298-4011
http://www.healthinfotechnics.com

sas >> CSV format importing problem, thank you!

by naga » Tue, 30 Jun 2009 16:06:42 GMT

n Jun 30, 3:58m, XXXX@XXXXX.COM (Carl Denney)
wrote:
> DBMS>CSV REPLACE;
> gt;GETNAMES=YES; >> DATAROW=2;
>>> gt;Guessingrows=20000;
> RUN;
>
> >t >3:>7 >M >/2>/>009, Nancy>wr>t>:
>
>
>
>
>
> >Thanks!!
>
> >On Jun 29, 3:26 pm, Nathaniel.W>o>.> XXXX@XXXXX.COM > (>a> >ooding) wrote:
> > > Nancy
>
> > > I usually write my own imput statements >o>I>don't use Import. If this is a
> > > one-time occurance, you can edit the f>l> >nd put a dummy record in front
> > > of line 2. Put a zip + 5 type zip code >n>t>e zip column and SAS will r>ad> >
> > > Nat Wooding >>>>>> Environmental Specialist III
> > > >ominion, Environmenta> >i>logy
> > > 4111 Cast>e>o>d Rd
> > > Richmond, VA 23234
> > > Ph>n>:>04-271-5313, Fax: 804-271-2977> >>>>>>el Phon>:>8>4-205-0752
>
> > > gt;gt;gt;ancy
>>> > nancy0318@GMAI>.> > > > ent by> >S>S(r) A...@LISTSE>V>U>A.EDU
> > > gt;iscussion" > > > c
> > > >A>.>@LISTSERV.U
> > > >.>D>> gt;gt;gt;> gt;gt;S>bject
> > > > > > gt;gt;e> CSV format importing prob>e>,> > > > gt;> gt;gt;gt;lt;hank>yo>!> > > > M
>
> > > gt;gt;gt;l>as> >e>pond to
> > > gt;> > > ancy
> > > > ><>ancy0318@GMAIL.
> > > > > > OM>
>
> > > T>a>k>you so much, Nat.
>
>>>>>>How I can change the f>ll>w>n> code i> S>S>t> read Zip as Cha>at>r> >
> > > The code I used is:
>
> > > PROC IMPORT OUT= >ut>i>e> > > > DBMS=CSV REPLACE;
> > > gt;E>N>M>S=YES;
> > > ATAROW=2;
>
> > > RUN;
>
> > > Thanks >g>i>!> >
> > > On Jun 29, 2:17 pm, XXXX@XXXXX.COM (Nat Wooding) wrote> >>> > > > > >a>cy
>
> > > > Without s>ei>g>t>e>actual input s>a>e>e>t and rror message, I can onl> >>>>>> > guess but I suspect that you a>e>r>a>ing Zip as a numeric >i>l> >nd SAS
> > > > will >e> >e>y upset if it sees a hypen in a numeric >i>l>.> would read
> > > it
> > >>> >s>a>c>aracter field. >>> > > > > >n>i>o>mental Spec>al>s> >II
>>>>>>>>Dominion, Environmental Biology
> > > > 4111 Castlewoo> >d> > > > > >h>ne:804-271-5313, Fax: 804->7>->9>7
> > > > gt;>C>l>Phone: 804>2>5>0>52
>
> > > > ancy
> > > > gt;gt;gt;nancy031>@>M>I>.
> > > > OM> >>>>>> To
> > > > gt;gt;e>t>by: "SAS(r) > gt;gt;gt;gt; XXXX@XXXXX.COM
> >>>>>>gt;iscuss>o>"> > > > > gt;gt;gt;S> XXXX@XXXXX.COM > >>> > > > > A.EDU>
> > > Subject
> > > > lt;gt;gt;gt;gt;SV format importing problem,
> > > thank
> > > > gt;> > > > ou!
> > > > 6/29/2009 02:12
> > > > > > > M
>
> > > > lease respond to
> > > > > > > > ancy
> > > > gt;> > > > > > > >>gt;gt;gt;OM>
>
> > > > In the CSV file, there is a va>i>b>e>named Zip, which includs number
> > > > values such as 32310 nd cha>a>t>r>value such as 32310-2345.
>
> > > > When i tried to import the file,>gt;h>r> was always error message for
> > > > the value 32310-2

Similar Threads

1. Semi-OT: format .csv or .htm, import to excel, retain leading zeros

2. Importing a CSV File: Format Conflicts

3. Importing CSV file format into Sas

Dear All:
  I am importing a CSV file format into SAS.  The values of one of the
variables is "01-JUN-2006 16:00:00" and when I import the file, SAS gives
an error and the import is unsuccessful. My presumption is that SAS does
not "like" the space in the value of this variable.  Are there any
suggestions for me to allow importation, perhaps by separating the the
values into two variables:  date -- "01-JUN-2006" and time -- "16:00:00".
Is there any code available for this procedure.
            Thanks

4. Problem with importing from a csv file

5. Problem importing CSV file

Hello All,

I am attempting to import an excel csv data file into SAS and am
encountering a strange problem.

the first few variables are importing just fine, but after say the
third variable, the variable names become var4,var5, var6 in the SAS
data set. so for example the dataset in sas looks like:

id lastname firstname age var5 var6 var7 etc..

even thought there are valid column headings for these variables
(var5,var6,var7)..when i convert the file to excel, the file imports
just fine. I am trying to automate the import of these files, so i
hope to avoid having to convert the csv to excel.

has anyone experienced this type of problem? here is the import
statement i am using.

proc import out= work.form&i
	datafile= "e:\forms\&dsn"
	dbms=csv replace;
	getnames=yes;
	datarow=2;
	guessingrows=20;
run;

Thank you for all your help,

nevin

6. GUESSINGCOLUMNS: PROC IMPORT/IMPORT Wizard CSV/TAB/DLM

7. CSV Export (Format problem)

8. Thanks : FORMAT Time Problem