Hello, thank you in adavance for your time and insight into solving my problem.
I am attempting to use a SAS FORMAT named $SICLONG. which I created using OSHA's SIC classifications. I was suscessful in creating it using the proc format cntlin option and it is stored in my home directory in a UNIX environment. I can also acess it with proc catalog and sucesssfully print it ubsing the following...
proc format library = MYFMT.formats fmtlib; SELECT $SICLONG; run;
However, when I attempt to call $SICLONG. in my program it does not error out, but all the values all resolve to "not found" which is the last format class. Interestingly, I also create a local proc format (named $sic.) which does resolve satisfactorily. The program is long, so I'm attching the important elemts below.
/**************************** PROGRAM ****************************/
libname MYFMT '/home/oselw';
OPTIONS FMTSEARCH=(MYFMT) obs=1000;
proc format;
value $sic
'01','02','07','08','09'='A: Agriculture, Forestry & Fishing'
'10','12','13','14'='B: Mining'
'15','16','17'='C: Construction '
/*... more classifications here*/
;
run;
data output_data_set;
set input_data_set;
/*unrelated stuff*/
mt_sic=substr(mt_industry,1,2);
mt_sic2=substr(mt_industry,1,4);
Master_sic=put(mt_sic, $sic.); /**** THIS WORKS*/
Master_sic2=put(mt_sic2, $SICLONG.); /**** THIS DOESNT WORK*/
run;
/**************************** OUTPUT ****************************/
The SAS System 12
Contents of Catalog MYFMT.FORMATS
# Name Type Create Date Modified Date
---------------------------------------------------------------------
1 INCOME FORMAT 11MAR2009:12:09:35 11MAR2009:12:09:35
2 INCOME FORMATC 11MAR2009:12:31:51 11MAR2009:12:31:51
3 SICLONG FORMATC 06MAR2009:09:55:43 06MAR2009:09:55:43
4 SIC_LON FORMATC 05MAR2009:14:15:18 05MAR2009:14:15:18
Contents of Catalog MYFMT.FORMATS
Last Last
Page Block Num of Block Block
# Description Size Size Blocks Bytes Size Pages
----------------------------------------------------------------------
1 4096 4096 519 1684 2040 519
2 4096 4096 393 1003 1020 393
3 4096 4096 9 1098 1275 9
4 4096 4096 9 1104 1275 9
The SAS System 13
----------------------------------------------------------------------------
| FORMAT NAME: $SICLONG LENGTH: 60 NUMBER OF VALUES: 445 |
| MIN LENGTH: 1 MAX LENGTH: 60 DEFAULT LENGTH 60 FUZZ: 0 |
|--------------------------------------------------------------------------|
|START |END |LABEL (VER. 8.2 06MAR2009:09:55:43)|
|----------------+----------------+----------------------------------------|
|100 |100 |AGRICULTURAL PRODUCTION-CROPS |
|200 |200 |AGRICULTURAL PROD-LIVESTOCK & ANIMAL SPE|
|700 |700 |AGRICULTURAL SERVICES |
|800 |800 |FORESTRY |
|900 |900 |FISHING, HUNTING AND TRAPPING |
|1000 |1000 |METAL MINING |
Thanks Scott! I don't have the comments in my program, but I appreciate the clarification for everyone who's looking!
Message was edited by: oliver_selwyn