Hey,
So I am new to SAS and really unsure of how SAS saves formats. However, I created multiple formats in the exact same way, which all seem to have been applied smoothly. However, one format (BOsex), will not apply as it says it cant be found or loaded. However, in the log window, the format says it was saved in the library work.formats (as did all of the others). What can I do to apply this format successfully?
Thank you! That's much more readable.
ERROR 48-59: The format $FBOSEX was not found or could not be loaded.
Note the $ in front of FBOSEX, this is because you are trying to assign a format to the character variable FBOSEX, and so SAS is looking for a character format named $FBOSEX which doesn't exist. When you create character formats, these formats must begin with a $.
But you have created a format for a numeric variable called FBOSEX (no dollar sign). You have to go back to your PROC FORMAT and change FBOSEX to $FBOSEX and also use character strings (in quotes) to the left of the = sign.
Please show us PROC CONTENTS run on data set Fin.All2 and see if variable BOSEX is numeric or character.
Also please show us the LOG from running your PROC format followed by a data step ... we need to see the entire log from this PROC FORMAT followed by a data step, both the part of the log that contains the code and also the part of the log that shows the error message. Do not chop anything out of the log for this PROC FORMAT followed by a data step; do not edit it in anyway. Copy the log as text and paste it into the window that appears when you click on the {i} icon when you reply here at SAS communities. Please do not skip these steps.
Proc Contents:
ATC | Num | 8 | BEST. | ATC | |
ATCBaby | Num | 8 | BEST. | ATCBaby | |
ATCBabyDE | Num | 8 | MMDDYY10. | ATCBabyDE | |
ATC_DE_Date | Num | 8 | MMDDYY10. | ATC DE Date | |
Add | Num | 8 | BEST. | Add | |
Anomalies | Num | 8 | BEST. | Anomalies | |
BOInsurancetype | Num | 8 | BEST. | BOInsurancetype | |
BOOZ | Num | 8 | BEST. | BOOZ | |
BORace | Char | 1 | $1. | $1. | BORace |
BOSex | Char | 1 | $1. | $1. | BOSex |
BOWeight | Num | 8 | BEST. | BOWeight | |
BOgestation | Num | 8 | BEST. | BOgestation | |
Birth | Num | 8 | MMDDYY10. | Birth | |
DOB | Num | 8 | MMDDYY10. | DOB | |
DOD | Num | 8 | MMDDYY10. | DOD | |
Dage | Num | 8 | BEST. | Dage | |
Date | Num | 8 | MMDDYY10. | Date | |
DateBFend | Num | 8 | MMDDYY10. | DateBFend | |
DateBFstart | Num | 8 | MMDDYY10. | DateBFstart | |
Disenrolled | Num | 8 | MMDDYY10. | Disenrolled | |
Doctor | Char | 50 | $50. | $50. | Doctor |
EPDS_Score | Num | 8 | BEST. | EPDS_Score | |
FQHC | Num | 8 | BEST. | FQHC | |
HMO | Num | 8 | BEST. | HMO | |
IDAge | Num | 8 | BEST. | IDAge | |
IDIncome | Num | 8 | BEST. | IDIncome | |
IDInsurance | Num | 8 | BEST. | IDInsurance | |
IDNUMBER | Char | 11 | $11. | $11. | IDNUMBER |
IDRace | Num | 8 | FIDRACE. | IDRace | |
IDcounty | Char | 9 | $9. | $9. | IDcounty |
IDeducat | Num | 8 | FIDEDUCAT. | IDeducat | |
IDethnicity | Num | 8 | FIDETHNICITY. | IDethnicity | |
IDmarital | Num | 8 | FIDMARITAL. | IDmarital | |
Insaddress | Char | 1 | $1. | $1. | Insaddress |
Insmedic | Num | 8 | BEST. | Insmedic | |
Insurance | Char | 50 | $50. | $50. | Insurance |
Language | Num | 8 | BEST. | Language | |
Last_enroll_date | Num | 8 | MMDDYY10. | Last_enroll_date | |
MAge | Num | 8 | BEST. | MAge | |
MBirth | Num | 8 | MMDDYY10. | MBirth | |
MRace | Num | 8 | BEST. | MRace | |
Meducat | Num | 8 | BEST. | Meducat | |
Methnicity | Num | 8 | BEST. | Methnicity | |
Miscarriage | Num | 8 | BEST. | Miscarriage | |
NICU | Num | 8 | BEST. | NICU | |
Nicudays | Num | 8 | BEST. | Nicudays | |
Numberperson | Num | 8 | BEST. | Numberperson | |
POSTBR6 | Num | 8 | BEST. | POSTBR6 | |
POSTCESD | Num | 8 | BEST. | POSTCESD | |
POSTCigarette | Num | 8 | BEST. | POSTCigarette | |
POSTDate | Num | 8 | MMDDYY10. | POSTDate | |
POSTDouching | Num | 8 | BEST. | POSTDouching | |
POSTHIV | Num | 8 | BEST. | POSTHIV | |
POSTHXbreast | Num | 8 | BEST. | POSTHXbreast | |
POSTInfantHIV | Num | 8 | BEST. | POSTInfantHIV | |
POSTInfantalcohol | Num | 8 | BEST. | POSTInfantalcohol | |
POSTInfantdurg | Num | 8 | BEST. | POSTInfantdurg | |
POSTInfanthomeless | Num | 8 | BEST. | POSTInfanthomeless | |
POSTInfantinjury | Num | 8 | BEST. | POSTInfantinjury | |
POSTInfantmental | Num | 8 | BEST. | POSTInfantmental | |
POSTInfantother | Char | 50 | $50. | $50. | POSTInfantother |
POSTLivearrange | Num | 8 | BEST. | POSTLivearrange | |
POSTNoChange | Num | 8 | BEST. | POSTNoChange | |
POSTOverweight | Num | 8 | BEST. | POSTOverweight | |
POSTPA | Num | 8 | BEST. | POSTPA | |
POSTPDSS | Num | 8 | BEST. | POSTPDSS | |
POSTPSS | Num | 8 | BEST. | POSTPSS | |
POSTPremature | Num | 8 | BEST. | POSTPremature | |
POSTQuitsmoking | Num | 8 | BEST. | POSTQuitsmoking | |
POSTSTD | Num | 8 | BEST. | POSTSTD | |
POSTStaff | Num | 8 | BEST. | POSTStaff | |
POSTUnderweight | Num | 8 | BEST. | POSTUnderweight | |
POSTWorkload | Num | 8 | BEST. | POSTWorkload | |
POSTalcohol | Num | 8 | BEST. | POSTalcohol | |
POSTasthma | Num | 8 | BEST. | POSTasthma | |
POSTbirthcontrol | Num | 8 | BEST. | POSTbirthcontrol | |
POSTbreastfed | Num | 8 | FPOSTBREASTFED. | POSTbreastfed | |
POSTbreastfeed6m | Num | 8 | BEST. | POSTbreastfeed6m | |
POSTcheckup | Num | 8 | BEST. | POSTcheckup | |
POSTcholesterol | Num | 8 | BEST. | POSTcholesterol | |
POSTcigarette3m | Num | 8 | BEST. | POSTcigarette3m | |
POSTcigarette7m | Num | 8 | BEST. | POSTcigarette7m | |
POSTcigarettepostpartum | Num | 8 | BEST. | POSTcigarettepostpartum | |
POSTdatein | Num | 8 | MMDDYY10. | POSTdatein | |
POSTdatequitsmoking | Num | 8 | MMDDYY10. | POSTdatequitsmoking | |
POSTdelivery | Num | 8 | BEST. | POSTdelivery | |
POSTdevelop | Num | 8 | BEST. | POSTdevelop | |
POSTdiabetes | Num | 8 | FPOSTDIABETES. | POSTdiabetes | |
POSTdometicviolence | Num | 8 | BEST. | POSTdometicviolence | |
POSTdruguse | Num | 8 | BEST. | POSTdruguse | |
POSTfamilymember | Num | 8 | BEST. | POSTfamilymember | |
POSTfather | Num | 8 | BEST. | POSTfather | |
POSTfatherreachable | Num | 8 | BEST. | POSTfatherreachable | |
POSTfobt | Num | 8 | BEST. | POSTfobt | |
POSThomeless | Num | 8 | BEST. | POSThomeless | |
POSThtn | Num | 8 | FPOSTHTN. | POSThtn | |
POSTinfantID | Num | 8 | BEST. | POSTinfantID | |
POSTinfantasthma | Num | 8 | BEST. | POSTinfantasthma | |
POSTinfantgainweight | Num | 8 | BEST. | POSTinfantgainweight | |
POSTinfantthrive | Num | 8 | BEST. | POSTinfantthrive | |
POSTmental | Num | 8 | BEST. | POSTmental | |
POSTothermed | Char | 50 | $50. | $50. | POSTothermed |
POSTperidontal | Num | 8 | BEST. | POSTperidontal | |
POSTsickle_cell | Num | 8 | BEST. | POSTsickle cell | |
POSTtype1 | Num | 8 | BEST. | POSTtype1 | |
POSTurinaryinfection | Num | 8 | BEST. | POSTurinaryinfection | |
POSTvaginosis | Num | 8 | BEST. | POSTvaginosis | |
PREACE | Num | 8 | BEST. | PREACE | |
PREBMI | Num | 8 | BEST. | PREBMI | |
PREBR6 | Num | 8 | BEST. | PREBR6 | |
PRECESD | Num | 8 | BEST. | PRECESD | |
PRECigarette | Num | 8 | BEST. | PRECigarette | |
PRECigarettebefore | Num | 8 | BEST. | PRECigarettebefore | |
PREDate | Num | 8 | MMDDYY10. | PREDate | |
PREDouching | Num | 8 | BEST. | PREDouching | |
PREEDCdate | Num | 8 | MMDDYY10. | PREEDCdate | |
PREHIV | Num | 8 | BEST. | PREHIV | |
PREHXofbreast | Char | 2 | $2. | $2. | PREHXofbreast |
PREHcervix | Num | 8 | BEST. | PREHcervix | |
PREHdeath | Num | 8 | BEST. | PREHdeath | |
PREHfetal | Num | 8 | BEST. | PREHfetal | |
PREHpremature | Num | 8 | BEST. | PREHpremature | |
PREHpreterm | Num | 8 | BEST. | PREHpreterm | |
PREInsurance | Num | 8 | BEST. | PREInsurance | |
PREMonthoflastpregnancy | Num | 8 | BEST. | PREMonthoflastpregnancy | |
PRENLBWBaby | Num | 8 | BEST. | PRENLBWBaby | |
PRENmiscarriage | Num | 8 | BEST. | PRENmiscarriage | |
PRENofathersupport | Num | 8 | BEST. | PRENofathersupport | |
PREOthersymspec | Char | 42 | $42. | $42. | PREOthersymspec |
PREOverweight | Num | 8 | BEST. | PREOverweight | |
PREPSS | Num | 8 | BEST. | PREPSS | |
PRESTD | Num | 8 | BEST. | PRESTD | |
PREStaff | Num | 8 | BEST. | PREStaff | |
PREUnderweight | Num | 8 | BEST. | PREUnderweight | |
PREWorkload | Num | 8 | BEST. | PREWorkload | |
PREalcohol | Num | 8 | BEST. | PREalcohol | |
PREasthma | Num | 8 | BEST. | PREasthma | |
PREdatein | Num | 8 | MMDDYY10. | PREdatein | |
PREdentalexam | Num | 8 | BEST. | PREdentalexam | |
PREdiabetes | Num | 8 | FPREDIABETES. | PREdiabetes | |
PREdometicviolence | Num | 8 | BEST. | PREdometicviolence | |
PREdruguse | Num | 8 | BEST. | PREdruguse | |
PREfamilymember | Num | 8 | BEST. | PREfamilymember | |
PREfeet | Num | 8 | BEST. | PREfeet | |
PREfirst | Num | 8 | MMDDYY10. | PREfirst | |
PREhighrisk | Num | 8 | BEST. | PREhighrisk | |
PREhomeless | Num | 8 | BEST. | PREhomeless | |
PREhtn | Num | 8 | FPREHTN. | PREhtn | |
PREinch | Num | 8 | BEST. | PREinch | |
PREinfantID | Num | 8 | BEST. | PREinfantID | |
PREmental | Num | 8 | BEST. | PREmental | |
PREnext | Num | 8 | MMDDYY10. | PREnext | |
PREnumkids | Num | 8 | BEST. | PREnumkids | |
PREnumpregnancy | Num | 8 | BEST. | PREnumpregnancy | |
PREothermed | Char | 50 | $50. | $50. | PREothermed |
PREperidontal | Num | 8 | BEST. | PREperidontal | |
PREsickle_cell | Num | 8 | BEST. | PREsickle cell | |
PREstage | Num | 8 | BEST. | PREstage | |
PREtovisit | Num | 8 | BEST. | PREtovisit | |
PREtype1 | Num | 8 | BEST. | PREtype1 | |
PREurinaryinfection | Num | 8 | BEST. | PREurinaryinfection | |
PREvaginosis | Num | 8 | BEST. | PREvaginosis | |
PREweight | Num | 8 | BEST. | PREweight | |
PREwhyrisk | Char | 50 | $50. | $50. | PREwhyrisk |
PREyearoflastpregnancy | Num | 8 | BEST. | PREyearoflastpregnancy | |
Ped | Char | 49 | $49. | $49. | Ped |
RaceEth | Num | 8 | FRACEETH. | ||
Reenroll | Num | 8 | BEST. | Reenroll | |
Safehome | Num | 8 | BEST. | Safehome | |
Sameasmail | Num | 8 | BEST. | Sameasmail | |
Staff | Num | 8 | BEST. | Staff | |
State | Char | 2 | $2. | $2. | State |
With_children | Num | 8 | BEST. | With_children | |
ZIP | Char | 5 | $5. | $5. | ZIP |
agegroup | Num | 8 | **bleep**EGROUP. | ||
bf6mfu | Num | 8 | BEST. | bf6mfu | |
birthweightt | Num | 8 | FBIRTHWEIGHTT. | ||
county2 | Char | 9 | |||
datein | Num | 8 | MMDDYY10. | datein | |
dateinspection | Num | 8 | MMDDYY10. | dateinspection | |
daterefe | Num | 8 | MMDDYY10. | daterefe | |
day | Num | 8 | BEST. | day | |
death | Num | 8 | BEST. | death | |
fatherdays | Num | 8 | BEST. | fatherdays | |
fatherread | Num | 8 | BEST. | fatherread | |
feeding | Num | 8 | BEST. | feeding | |
immunization | Num | 8 | BEST. | immunization | |
incomegroup | Num | 8 | FINCOMEGROUP. | ||
infantID | Num | 8 | BEST. | infantID | |
infantgest | Num | 8 | FINFANTGEST. | ||
infantweight | Num | 8 | |||
insaddesss | Char | 32 | $32. | $32. | insaddesss |
insother | Num | 8 | BEST. | insother | |
inspolicy | Char | 15 | $15. | $15. | inspolicy |
insrelation | Char | 7 | $7. | $7. | insrelation |
insurancenu | Char | 1 | $1. | $1. | insurancenu |
militar | Num | 8 | BEST. | militar | |
month | Num | 8 | BEST. | month | |
motherdays | Num | 8 | BEST. | motherdays | |
motherread | Num | 8 | BEST. | motherread | |
parentsdays | Num | 8 | BEST. | parentsdays | |
parentsread | Num | 8 | BEST. | parentsread | |
school | Char | 29 | $29. | $29. | school |
source | Num | 8 | BEST. | source | |
visits | Num | 8 | BEST. | visits | |
week | Num | 8 | BEST. | week | |
weeks | Num | 8 | BEST. | weeks | |
with_parents | Num | 8 | BEST. | with_parents | |
with_roommate | Num | 8 | BEST. | with_roommate | |
with_spouse | Num | 8 | BEST. | with_spouse |
I am going to stress the importance of pasting the log into the window that appears when you click on the {i} icon. This preserves the formatting of the log, so it appears to us exactly as you see it, and greatly improves our ability to understand what the log is telling us.
Please make our job easier by following these instructions.
119 proc format; 120 value fIDrace 121 1 = 'Black' 122 2 = 'White' 123 3 = 'Asian' 124 4 = 'NativeAM' 125 5 = 'HawaiianPI' 126 6 = 'Multi' 127 7 = 'Other' 128 ; NOTE: Format FIDRACE has been output. 129 value **bleep**egroup 130 1 = '<20' 131 2 = '20-24' 132 3 = '25-29' 133 4 = '30-34' 134 5 = '35-39' 135 6 = '40+' 136 ; NOTE: Format **bleep**EGROUP has been output. 137 value fIDethnicity 138 1 = 'Non-Hisp' 139 2 = 'Hisp' 140 ; NOTE: Format FIDETHNICITY has been output. 141 value fIDmarital 142 1 = 'Single' 143 2 = 'Separated' 144 3 = 'Divorced' 145 4 = 'Widowed' 146 5 = 'Married' 147 ; NOTE: Format FIDMARITAL has been output. 148 value fincomegroup 149 1 = 'Less than 10000' 150 2 = 'Between 10000-14999' 151 3 = 'Between 15000-19999' 152 4 = 'Between 20000-24999' 153 5 = 'Between 25000-34999' 154 6 = 'Between 35000-49999' 155 7 = 'Between 50000-74999' 156 8 = '75000 and up' 157 ; NOTE: Format FINCOMEGROUP has been output. 158 value fraceeth 159 11 = 'Black' 160 12 = 'Hispanic' 161 21 = 'White' 162 31 = 'Asian/PI/Hawaiian' 163 41 = 'Native American' 164 61 = 'Multi/Other' 165 ; NOTE: Format FRACEETH has been output. 166 value fIDeducat 167 0 = 'None' 168 1 = 'Less than HS' 169 2 = 'Less than HS' 170 3 = 'Less than HS' 171 4 = 'Less than HS' 172 5 = 'Less than HS' 173 6 = 'Less than HS' 174 7 = 'Less than HS' 175 8 = 'Less than HS' 176 9 = 'High School' 177 10 = 'High School' 178 11 = 'High School' 179 12 = 'High School' 180 13 = 'More than HS' 181 14 = 'More than HS' 182 15 = 'More than HS' 183 16 = 'More than HS' 184 17 = 'More than HS' 185 18 = 'More than HS' 186 22 = 'More than HS' 187 ; NOTE: Format FIDEDUCAT has been output. 188 value fPostbreastfed 189 0 = 'No' 190 1 = 'Yes' 191 ; NOTE: Format FPOSTBREASTFED has been output. 192 value finfantgest 193 1 = 'PTB' 194 2 = 'FTB' 195 ; NOTE: Format FINFANTGEST has been output. 196 value fBOsex 197 1 = 'Boy' 198 2 = 'Girl' 199 3 = 'Unknown' 200 ; NOTE: Format FBOSEX has been output. 201 value fPrehtn 202 0 = 'No' 203 1 = 'Yes' 204 ; NOTE: Format FPREHTN has been output. 205 value fPosthtn 206 0 = 'No' 207 1 = 'Yes' 208 ; NOTE: Format FPOSTHTN has been output. 209 value fPrediabetes 210 0 = 'No' 211 1 = 'Yes' 212 ; NOTE: Format FPREDIABETES has been output. 213 value fPostdiabetes 214 0 = 'No' 215 1 = 'Yes' 216 ; NOTE: Format FPOSTDIABETES has been output. 217 value fbirthweightt 218 1 = 'LBW' 219 2 = 'NBW' 220 3 = 'MBW' 221 ; NOTE: Format FBIRTHWEIGHTT has been output. 222 run; NOTE: PROCEDURE FORMAT used (Total process time): real time 0.05 seconds cpu time 0.06 seconds 223 224 data Fin.All2; 225 set Fin.All2; 226 format BOsex fBOsex. IDRace fIDrace. Agegroup **bleep**egroup. IDEthnicity fIDEthnicity. IDMarital ------- 48 226! fIDMarital. Incomegroup fIncomegroup. IDEducat fIDEducat. Raceeth fraceeth. Postbreastfed 226! fpostbreastfed. Infantgest finfantgest. birthweightt fbirthweightt. Prehtn fPrehtn. Posthtn 226! fPosthtn. Prediabetes fPrediabetes. Postdiabetes fPostdiabetes.; ERROR 48-59: The format $FBOSEX was not found or could not be loaded. 227 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set FIN.ALL2 may be incomplete. When this step was stopped there were 0 observations and 210 variables. WARNING: Data set FIN.ALL2 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.10 seconds cpu time 0.03 seconds
Thank you! That's much more readable.
ERROR 48-59: The format $FBOSEX was not found or could not be loaded.
Note the $ in front of FBOSEX, this is because you are trying to assign a format to the character variable FBOSEX, and so SAS is looking for a character format named $FBOSEX which doesn't exist. When you create character formats, these formats must begin with a $.
But you have created a format for a numeric variable called FBOSEX (no dollar sign). You have to go back to your PROC FORMAT and change FBOSEX to $FBOSEX and also use character strings (in quotes) to the left of the = sign.
Sorry! I'm still learning how to work the site. But thank you so much, that worked!
proc format; value fIDrace 1 = 'Black' 2 = 'White' 3 = 'Asian' 4 = 'NativeAM' 5 = 'HawaiianPI' 6 = 'Multi' 7 = 'Other' ; value agegroup 1 = '<20' 2 = '20-24' 3 = '25-29' 4 = '30-34' 5 = '35-39' 6 = '40+' ; value fIDethnicity 1 = 'Non-Hisp' 2 = 'Hisp' ; value fIDmarital 1 = 'Single' 2 = 'Separated' 3 = 'Divorced' 4 = 'Widowed' 5 = 'Married' ; value fincomegroup 1 = 'Less than 10000' 2 = 'Between 10000-14999' 3 = 'Between 15000-19999' 4 = 'Between 20000-24999' 5 = 'Between 25000-34999' 6 = 'Between 35000-49999' 7 = 'Between 50000-74999' 8 = '75000 and up' ; value fraceeth 11 = 'Black' 12 = 'Hispanic' 21 = 'White' 31 = 'Asian/PI/Hawaiian' 41 = 'Native American' 61 = 'Multi/Other' ; value fIDeducat 0 = 'None' 1 = 'Less than HS' 2 = 'Less than HS' 3 = 'Less than HS' 4 = 'Less than HS' 5 = 'Less than HS' 6 = 'Less than HS' 7 = 'Less than HS' 8 = 'Less than HS' 9 = 'High School' 10 = 'High School' 11 = 'High School' 12 = 'High School' 13 = 'More than HS' 14 = 'More than HS' 15 = 'More than HS' 16 = 'More than HS' 17 = 'More than HS' 18 = 'More than HS' 22 = 'More than HS' ; value fPostbreastfed 0 = 'No' 1 = 'Yes' ; value finfantgest 1 = 'PTB' 2 = 'FTB' ; value fBOsex 1 = 'Boy' 2 = 'Girl' 3 = 'Unknown' ; value fPrehtn 0 = 'No' 1 = 'Yes' ; value fPosthtn 0 = 'No' 1 = 'Yes' ; value fPrediabetes 0 = 'No' 1 = 'Yes' ; value fPostdiabetes 0 = 'No' 1 = 'Yes' ; value fbirthweightt 1 = 'LBW' 2 = 'NBW' 3 = 'MBW' ; run; data Fin.All2; set Fin.All2; format BOsex fBOsex. IDRace fIDrace. Agegroup **bleep**egroup. IDEthnicity fIDEthnicity. IDMarital fIDMarital. Incomegroup fIncomegroup. IDEducat fIDEducat. Raceeth fraceeth. Postbreastfed fpostbreastfed. Infantgest finfantgest. birthweightt fbirthweightt. Prehtn fPrehtn. Posthtn fPosthtn. Prediabetes fPrediabetes. Postdiabetes fPostdiabetes.; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.