From: astrogirl on 17 Jun 2010 15:22 Im running SAS 9.2 with Windows Vista and I have run across an issue while importing SPSS files (I'm using version 18) into SAS. I have tried to import them as .dbf, .sav, and .por and I get the same issue every time. The files quadruple or quintuple in size from the SPSS to the SAS format. I have one file in particular that I use most often (its updated each month) and currently in SPSS format its 30GB. When I import it into SAS each of the ways listed above, it becomes around 150 GB. It still has the same number of variables and observations as in the various SPSS formats but the size has grown by five times. Usually I work in SPSS but Im trying to learn SAS because I can process large files more rapidly that way. So normally this file I get is in text format and another person in my department imports them into SPSS and sets them up as .sav files because that is the program that most of us use and there are several of us that use that particular file regularly. It wont import into SAS however as a text file because some of the fields are character variables and some have issues. One in particular, last name, is troublesome because it has spaces between the letters and when its importing in SAS, it hits those spaces and stops. I know I can remove the spaces but doing anything with these files in SPSS takes hours because they are so large so I would like to avoid any extra steps like that if possible as I am trying to be more efficient. Ideally, I would like to be able to import the .sav file into SAS and have it be around the same size as the original. Is that possible? If not I would appreciate any other import suggestions to keep the file size down. Thanks, Angie
From: data _null_; on 17 Jun 2010 16:02 On Jun 17, 2:22 pm, astrogirl <servo262...(a)yahoo.com> wrote: > It wont import into SAS however as a text > file because some of the fields are character variables and some have > issues. One in particular, last name, is troublesome because it has > spaces between the letters and when its importing in SAS, it hits > those spaces and stops. You comment about not being able to "import" the file into SAS seem odd. I assume by IMPORT you mean read the field in records from a text file. If you can read the file into SPSS you can surely do the same with SAS. I expect you have make a simple mistake that can be easily solved. So forget about SPSS and read the file directly into SAS. Post an example of the records from the file and ask has how best to read the data.
From: astrogirl on 1 Jul 2010 10:56 Thanks for the responses and Im sorry its taken me so long to respond but I got sidelined with another project. Heres the import program that I set up going through the wizard using a tab delimited text file format. My file doesnt have variable names. PROC IMPORT OUT= CM_FILES.test DATAFILE= "N:\CM files\cm_enrollment_instance.txt" DBMS=TAB REPLACE; GETNAMES=No; DATAROW=1; RUN; Heres a sample of my data and this includes the record where Im having the problem. I can read the tab delimited text file into SAS up until it hits the record with the last name O NEAL then it stops. 44 0 1234567 SPEARS CARRIE 50 0 1234567 SPEARS CARRIE 1 0 . 43 0 . 1 0 1234567 SANCHEZ ISMAIL 1 0 1234567 SANCHEZ ISMAIL 98 0 1234567 ARNOLD JR JOHN 1 0 1234567 ARNOLD JR JOHN 21 0 1234567 ARNOLD JR JOHN 58 1 1234567 SMITH-KONES AMY 25 1 1234567 SMITH-KONES AMY 1 1 1234567 SMITH-KONES AMY 1 1 1234567 Garrett Thomas V 69 1 1234567 O NEAL COLLEEN 1 1 1234567 O NEAL COLLEEN 5 1 1234567 FULLER ALI S 2 1 1234567 CALHOUN SLY M 70 1 1234567 CALHOUN SLY M 16 1 1234567 DANIEL JR. MICHAEL J 1 1 1234567 DANIEL JR. MICHAEL J 1 1 1234567 DANIEL JR. MICHAEL J 204 1 1234567 KURCZEWSKI-LYONS DAWN M Heres some info about the fields shown in the sample data set. cm_days_in_service = numeric 10 spaces cm_valid_ssn_flag = numeric 1 space customer_id = numeric 10 spaces last_name = character 30 spaces first_name = character 20 spaces middle_initial = character 1 space Thanks! Angie
From: Tom Abernathy on 3 Jul 2010 00:55 Hard to tell with the mangling of the example text by the email system. Doesn't look tab delimited in the email. You do not need to use PROC IMPORT to read a text file. Just write your own DATA step. Especially if you already know the fields. data cm_files.test ; infile'.....' truncover dlm='09'x dsd ; length cm_days_in_service 8 cm_valid_ssn_flag $1 customer_id $10 last_name $30 first_name $20 middle_initial $1 ; input cm_days_in_service -- middle_initial ; run; Note that SAS stores numbers as floating point. So your 10 digit number will be stored in a normal 8 byte long numeric variable. On Jul 1, 10:56 am, astrogirl <servo262...(a)yahoo.com> wrote: > Thanks for the responses and Im sorry its taken me so long to > respond but I got sidelined with another project. > > Heres the import program that I set up going through the wizard using > a tab delimited text file format. My file doesnt have variable > names. > > PROC IMPORT OUT= CM_FILES.test > DATAFILE= "N:\CM files\cm_enrollment_instance.txt" > DBMS=TAB REPLACE; > GETNAMES=No; > DATAROW=1; > RUN; > > Heres a sample of my data and this includes the record where Im > having the problem. I can read the tab delimited text file into SAS up > until it hits the record with the last name O NEAL then it stops. > > 44 0 1234567 SPEARS CARRIE > 50 0 1234567 SPEARS CARRIE > 1 0 . > 43 0 . > 1 0 1234567 SANCHEZ ISMAIL > 1 0 1234567 SANCHEZ ISMAIL > 98 0 1234567 ARNOLD JR JOHN > 1 0 1234567 ARNOLD JR JOHN > 21 0 1234567 ARNOLD JR JOHN > 58 1 1234567 SMITH-KONES AMY > 25 1 1234567 SMITH-KONES AMY > 1 1 1234567 SMITH-KONES AMY > 1 1 1234567 Garrett Thomas > V > 69 1 1234567 O NEAL COLLEEN > 1 1 1234567 O NEAL COLLEEN > 5 1 1234567 FULLER ALI > S > 2 1 1234567 CALHOUN SLY > M > 70 1 1234567 CALHOUN SLY > M > 16 1 1234567 DANIEL JR. MICHAEL > J > 1 1 1234567 DANIEL JR. MICHAEL > J > 1 1 1234567 DANIEL JR. MICHAEL > J > 204 1 1234567 KURCZEWSKI-LYONS DAWN > M > > Heres some info about the fields shown in the sample data set. > > cm_days_in_service = numeric 10 spaces > cm_valid_ssn_flag = numeric 1 space > customer_id = numeric 10 spaces > last_name = character 30 spaces > first_name = character 20 spaces > middle_initial = character 1 space > > Thanks! > > Angie
|
Pages: 1 Prev: Lookup table from excel spreadsheet Next: PROC MIXED/GLIMMIX disagreement |