comp.soft-sys.sas - The SAS statistics package.
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
Just read the access file using SAS/ PC files , or save excel file as .csv file and read using import data wizard in case you have just base SAS. Thats the fastest way. I think you should expand the right most side column length size (ag =10 or members =9 ) depending on how your data is . HTH. Ajay www.decisionstats.com On Wed, Jun 11, 2008 at 10:46 PM, Irin later < XXXX@XXXXX.COM > wrote: > I imported a bunch of soutce text tilde delimited files into SAS 9.1 > The problem is that for a couple of files SAS read just 14 records while I > have 15 !!!!! One record is lost > When I imported source file into Access or Excel It showed exactly 15 > records. > I tried to read data directly from the source tilde delimited file , but > try as I might, I was unable to identify any problem in the data > (actually it is hard to evaluate/read tilde delimited file manually. > Honestly , I do not know how to do it) > So far I wonder why Access (as well as Excel) was able to read all records > while SAS could not. > Actually I have a bunch of files and the following code worked just fine > with an exception of a couple of files. > data IP_r; > infile 'p:\Irin\temp\200801_IP_R.txt' > delimiter = '~' MISSOVER DSD lrecl=32767 firstobs=3; > length nm $12 > end_period_id 8 > nm_type $25 > region $23 > members 8 > ag 8 ; > input nm end_period_id nm_type region members ag ; > obsnum + 1; > run; > > log did not complain and gave me the following notes: > NOTE: The infile 'p:\Irin\temp\200801_IP_R.txt' is: > File Name=p:\Irin\temp\200801_IP_R.txt, > RECFM=V,LRECL=32767 > NOTE: 14 records were read from the infile > 'p:\Irin\temp\200801_IP_R.txt'. > The minimum record length was 341. > The maximum record length was 389. > How can I find what was wrong? Could you please give me a hand? > -What can I do to identify a problem in data which caused that different > approach ? > OR > -what can be fixed in my SAS code to avoid that confusion? > Thank you in advance, > Irin >
Hello again I have a .csv file with two columns, named CORE and CLUSTER. Core is a character field, cluster is numeric. The first few lines of CORE are 6 characters long e.g. 00614D 08185C 08394B 08545A but later on, they are longer, e.g., BW27011a BW28011a BW29011a BW31011a EN20101A EN20102A (Yes, I know, that's a terrible way to write a variable, but it was due to it being input over a period of 25 years or so, from machines that required certain formats, which differed over time....) I am importing it into SAS using PROC IMPORT OUT= WORK.twoclust DATAFILE= "C:\Fivelead\Data\twoclust.csv" DBMS=CSV REPLACE; GETNAMES=YES; DATAROW=2; RUN; and this is creating two variable, appropriately CORE and CLUSTER, but CORE is formatted as $6. This causes major problems, because the first 6 characters of CORE are not unique. Two questions: 1) How can I fix this? 2) Isn't this a horrible bug? Thanks in advance Peter PS I will also write to SAS tech support about this. Peter L. Flom, PhD Statistical Consultant www DOT peterflom DOT com
Dear SAS-L I need to import a comma delimited file where there could be anything between 1 and 5 additional rows of data after the original item. The data is title information - a catalogue extract - and each new record begins "ISBN: ". Following this there is a blank line then DETAIL1-3, then another blank line and if there are more details then DETAIL4-6, or otherwise there will be a new record again beginning "ISBN: ". I've used this sort of syntax in the past but how can I get it to check whether to create a new record or additional detail data? <sascode> data test; retain ISBN det1 det2 det3 det4 det5 det6 email web; infile "&path\Docs\CSV\_list.csv" dlm = ',' dsd missover firstobs = 1; informat det1 8. det2 $60. det3 $30. email web $50. det4 $100. det5 det6 $20.; input det1 det2 $ det3 $ det4 $ det5 $ / j1 $ j2 $ j3 $ det6 $ email $ #3 j4 $ j5 $ j6 $ j7 $ web $; drop j1 j2 j3 j4 j5 j6 j7; run; </sascode> TIA.