LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 12 Jul 2006 23:16:34 -0400
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: import csv data

Mental typo correction: On Wed, 12 Jul 2006 21:44:33 -0400, Arthur Tabachneck <art297@NETSCAPE.NET> wrote:

>The easiest method I can think of is to use proc import. For example: > >PROC IMPORT OUT= WORK.TEST > DATAFILE= "S:\test.csv" > DBMS=CSV REPLACE; > GETNAMES=YES; > DATAROW=2; >RUN; > >That will assign a hyphen before each year in the variable names. There

'hyphen' should have read 'underscore'

>appears to be a bug, though, that I hadn't seen before. If the first >variable name is a number (e.g., 1999), it will strip off the first digit >thus giving you 999. All of the other years import with the correct >variable names. > >The test.csv file I used contained the following: > >1999,2000,2001 >1,2,3 >4,5,6 > >and resulted with > >_999 _2000 _2001 > 1 2 3 > 4 5 6 > >Art >---------- >On Wed, 12 Jul 2006 17:58:15 -0700, j.zhu@IMB.UQ.EDU.AU wrote: > >>Hi, >> >>I try to import a .csv data into SAS. When using 'import' command, the >>first line of the data is used as variable names. In my case, my first >>line contains variable names, but they are numbers. (1971, 1972, >>1973.....). I would like to use them as variable names as they are >>years. However, 'import' command treated them as numbers, and so do not >>consider them to be variable names. I am wondering if there is a way to >>get around it? >> >>Thank you.


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