Date: Tue, 23 Aug 2011 22:48:09 -0400
Reply-To: Arthur Tabachneck <art297@ROGERS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@ROGERS.COM>
Subject: Re: Reading in from csv files - when does SAS make VAR out of
what is in header?
Nat,
I haven't seen the file yet, but have to wonder why that was the only
character that caused a problem.
I agree with DN, that options validvarname=any; can often eradicate such
problems. Nat, once we can read a file, we can always rename the variables
so that others don't run into similar problems.
Art
------
On Tue, 23 Aug 2011 22:02:10 -0400, Nat Wooding <nathani@VERIZON.NET> wrote:
>Null
>
>Good point! The option does work nicely. However, may I suggest that it
will
>be a bit of a nuisance for most of us to try to write code that contains a
>Greek mu embedded in a variable name. Converting it to a lower case u would
>save me a whole lot of trouble.
>
>Nat
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Data
>_null_;
>Sent: Tuesday, August 23, 2011 9:56 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Reading in from csv files - when does SAS make VAR out of what
>is in header?
>
>Try it with
>
>options validvarname=any;
>
>On Tue, Aug 23, 2011 at 8:48 PM, Nat Wooding <nathani@verizon.net> wrote:
>> Friends
>>
>> Peter and I corresponded off line about this and he sent me a sample of
>the
>> file.
>>
>> I, too, got the variable labeled VAR but the other names followed their
>> original form seen in the CSV. However, none of the other variables had a
>> Greek letter in their names. Their units were nanograms per milliliter
and
>> the symbol for "nano" is an 'n'. It looks to me like SAS is choking on
the
>> 'mu' symbol which it can't convert it an English letter. After all, Greek
>> letters are not valid in SAS variable names.
>>
>> I suggested to Peter that he simply change mu to a lower case 'u' in the
>> Excel file. That was how I wrote the symbol for micrograms when I was
>> reporting chemical results.
>>
>> Nat Wooding
>>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Peter
>> Flom
>> Sent: Monday, August 22, 2011 3:03 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Reading in from csv files - when does SAS make VAR out of what
is
>> in header?
>>
>> Good afternoon
>>
>>
>>
>> I often (well, pretty much always) get data from clients in Excel.
>Usually,
>> I save it as .csv and then read it into SAS using the import wizard.
>>
>>
>>
>> Clients do funny things. They name 20 variables with the same name.
>Really.
>> Sometimes this is the fault of the product they used to get the data, and
>> you get things like 10 variables named question1. When this happens, SAS
>> sometimes copes by creating variables named VAR XX. Nice. It alerts you
>> that there is a problem, doesn't overwrite data, and is a good solution.
>>
>>
>>
>> BUT
>>
>>
>>
>> Recently, a client sent an Excel file. One of the header rows was BAP
>mug/l
>> (where mu is the Greek letter). None of the other variables started with
>> BAP, and SAS coped fine with other variables that had Greek letters. But
>for
>> some reason, BAP was renamed with a VAR.
>>
>>
>>
>> This caused me some embarrassment, with me telling the client there was
no
>> variable called BAP and her saying = there it is! Look at the
spreadsheet.
>>
>>
>>
>> Has anyone else run into this?
>>
>>
>>
>> Peter
>>
>>
>>
>> Peter Flom
>>
>> Peter Flom Consulting
>>
>> http://www.statisticalanalysisconsulting.com/
>>
>> http://www.IAmLearningDisabled.com
>>
|