I am trying to create a user defined format in SAS by doing the following:
1) Create the user-defined format in Excel 2) Import the table to SAS as a dataset 3) Read the dataset to create a new format
This seems to be working, except for one snafu. I previously created the exact same datasets/formats, but used an illegal SAS naming convention. I used the convention "_14_to_17" - SAS doesn't like when you end with a number, and errored out.
I thought that changing the format name/sheet to _14_17_map would solve the problem (no number at the end!) but now it just gives me this error -
ERROR: The format name $_14_TO_17 ends in a number, which is invalid.
ERROR: Format name '' is invalid. Observation ignored.
during the proc format step.
Interestingly, I created other formats using the correct naming convention of "_14_15_map" that were not previously created using the incorrect "_14_to_15" naming convention. These formats seem to load fine.
Does anyone know what I am missing here?
Here is my macro:
%macro import_format(file,sheet);
*imports the table - this step is working;
proc import
datafile="&file."
out=userlib.&sheet.
dbms=excel replace;
SHEET="&sheet.";
GETNAMES=YES;
run;
*creates the format - this step is NOT working;
PROC FORMAT CNTLIN=userlib.&sheet. library=userlib;
run;
%mend;
%import_format(&format_library.,_14_17_map);
Thanks for your help!