LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Nov 2004 10:29:28 -0800
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: Why my date names were cut short after using IMPORT proc
Comments: To: Fred <ieaggie2002@gmail.com>

Fred -

In SAS 9 you can - they are called "name literals" and were created for DBMS compatibility. You use quotes around the variable name followed by an "n". Look them up on the SAS online.doc. There is also a name literal function you may be interested in NLITERAL(string).

/* must allow them (they are still experimental) */ Options VALIDVARNAME=ANY;

/* '1996xPxx'n is a variable name - when printed or exported it reads 1996xPxx */ Data whatever; '1996xPxx'n=1234; run;

hth

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: Fred [mailto:ieaggie2002@gmail.com] Sent: Monday, November 22, 2004 10:19 AM To: Choate, Paul@DDS Cc: sas-l@listserv.uga.edu Subject: Re: Why my date names were cut short after using IMPORT proc

Thanks, Paul.

But I need to make the variable's name consistent with other data sources, That is, I have to keep '1999PXX' or '200xPxx' as my date format. So can I change the column's name from '_999Pxx' and'_00xPxx' to '1999 and '200xPxx' after I imported the data file?

Fred

On Mon, 22 Nov 2004 09:46:57 -0800, Choate, Paul@DDS <pchoate@dds.ca.gov> wrote: > > > Fred - variable names can't start with a number! Try Y1999P01, I use CY and > FY for calendar and fiscal years and FD for federal fiscal year. > > hth > > > Paul Choate > DDS Data Extraction > (916) 654-2160 > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Fred > Sent: Monday, November 22, 2004 9:35 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Why my date names were cut short after using IMPORT proc > > Hi, all > > My orignal data file is a .txt file, like > 1999P01 1999P02 1999P03 .... > Group1 xxx xxx xxxxx > Group2 xxx xx xxx > .... > > My import proc code is: > PROC IMPORT DATAFILE = 'data.txt' > OUT = test DBMS = TAB REPLACE; > RUN; > > After running the code, the output data set becomes: > Var1 _999P01 _999P02 _999P03 ... > Group1 xxx xxx xxxxx > Group2 xxx xx xxx > .... > > How to make the imported dates (YearMonth) not to be cut off? > > Thanks. > > Fred


Back to: Top of message | Previous page | Main SAS-L page