That doesn't work. That has to do with Formats and Value Labels (which I don't need), not Length.
Without Fmtlib statement, It deciphers numeric and character fields just fine. With it added, all character field lengths are still 2000, as are Informat and Format, which are probably derived from Length, and not carried over from SPSS.
I also tried the Import Wizard and saved the SAS Program it created to run later in Background after the PROC Import step. That does not do the job either.
This is PC-based SAS 9.4 on Windows, not Enterprise SAS.
>Without Fmtlib statement, It deciphers numeric and character fields just fine. With it added, all character field lengths are still 2000,
Show us the code please.
/* PROGRAM 1_000_Import_from_SPSS */
OPTION SYMBOLGEN;
%LET CCYY = 2018;
%LET MMDD = 0926;
LIBNAME S "S:\Encrypt - S Drive\DM_Work\Temp_Joe_Versaggi\NJCAT3\&CCYY._&MMDD.";
FILENAME NEWCASES "S:\Encrypt - S Drive\DM_Work\Temp_Joe_Versaggi\NJCAT3\&CCYY._&MMDD.\
NJCAT 3 Processed Data (2018-09-25 Download) - New Cases (96)
.sav";
PROC IMPORT
DATAFILE=NEWCASES
OUT=S.pgm_001_New__&ccyy.&mmdd.
DBMS=SPSS REPLACE;
FMTLIB = WORK.FORMATS;
RUN;
/* END PROGRAM 1_000 */
You are using DBMS=SPSS. The article that someone linked above used DBMS=SAV.
The result is exactly the same. Length = 2000, Informat and Format $2000 of all character fields.
PROC IMPORT
14 DATAFILE=NEWCASES
15 OUT=S.pgm_001_New__&ccyy.&mmdd.
SYMBOLGEN: Macro variable CCYY resolves to 2018
SYMBOLGEN: Macro variable MMDD resolves to 0926
16 DBMS=SAV REPLACE;
17 FMTLIB = WORK.FORMATS;
18
19 RUN;
NOTE: The import data set has 96 observations and 388 variables.
NOTE: S.PGM_001_NEW__20180926 data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 1.43 seconds
cpu time 0.31 seconds
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: