BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SM8
Obsidian | Level 7 SM8
Obsidian | Level 7

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?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

 

 

--
Paige Miller

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
SM8
Obsidian | Level 7 SM8
Obsidian | Level 7

Proc Contents:

 

ATCNum8BEST. ATC
ATCBabyNum8BEST. ATCBaby
ATCBabyDENum8MMDDYY10. ATCBabyDE
ATC_DE_DateNum8MMDDYY10. ATC DE Date
AddNum8BEST. Add
AnomaliesNum8BEST. Anomalies
BOInsurancetypeNum8BEST. BOInsurancetype
BOOZNum8BEST. BOOZ
BORaceChar1$1.$1.BORace
BOSexChar1$1.$1.BOSex
BOWeightNum8BEST. BOWeight
BOgestationNum8BEST. BOgestation
BirthNum8MMDDYY10. Birth
DOBNum8MMDDYY10. DOB
DODNum8MMDDYY10. DOD
DageNum8BEST. Dage
DateNum8MMDDYY10. Date
DateBFendNum8MMDDYY10. DateBFend
DateBFstartNum8MMDDYY10. DateBFstart
DisenrolledNum8MMDDYY10. Disenrolled
DoctorChar50$50.$50.Doctor
EPDS_ScoreNum8BEST. EPDS_Score
FQHCNum8BEST. FQHC
HMONum8BEST. HMO
IDAgeNum8BEST. IDAge
IDIncomeNum8BEST. IDIncome
IDInsuranceNum8BEST. IDInsurance
IDNUMBERChar11$11.$11.IDNUMBER
IDRaceNum8FIDRACE. IDRace
IDcountyChar9$9.$9.IDcounty
IDeducatNum8FIDEDUCAT. IDeducat
IDethnicityNum8FIDETHNICITY. IDethnicity
IDmaritalNum8FIDMARITAL. IDmarital
InsaddressChar1$1.$1.Insaddress
InsmedicNum8BEST. Insmedic
InsuranceChar50$50.$50.Insurance
LanguageNum8BEST. Language
Last_enroll_dateNum8MMDDYY10. Last_enroll_date
MAgeNum8BEST. MAge
MBirthNum8MMDDYY10. MBirth
MRaceNum8BEST. MRace
MeducatNum8BEST. Meducat
MethnicityNum8BEST. Methnicity
MiscarriageNum8BEST. Miscarriage
NICUNum8BEST. NICU
NicudaysNum8BEST. Nicudays
NumberpersonNum8BEST. Numberperson
POSTBR6Num8BEST. POSTBR6
POSTCESDNum8BEST. POSTCESD
POSTCigaretteNum8BEST. POSTCigarette
POSTDateNum8MMDDYY10. POSTDate
POSTDouchingNum8BEST. POSTDouching
POSTHIVNum8BEST. POSTHIV
POSTHXbreastNum8BEST. POSTHXbreast
POSTInfantHIVNum8BEST. POSTInfantHIV
POSTInfantalcoholNum8BEST. POSTInfantalcohol
POSTInfantdurgNum8BEST. POSTInfantdurg
POSTInfanthomelessNum8BEST. POSTInfanthomeless
POSTInfantinjuryNum8BEST. POSTInfantinjury
POSTInfantmentalNum8BEST. POSTInfantmental
POSTInfantotherChar50$50.$50.POSTInfantother
POSTLivearrangeNum8BEST. POSTLivearrange
POSTNoChangeNum8BEST. POSTNoChange
POSTOverweightNum8BEST. POSTOverweight
POSTPANum8BEST. POSTPA
POSTPDSSNum8BEST. POSTPDSS
POSTPSSNum8BEST. POSTPSS
POSTPrematureNum8BEST. POSTPremature
POSTQuitsmokingNum8BEST. POSTQuitsmoking
POSTSTDNum8BEST. POSTSTD
POSTStaffNum8BEST. POSTStaff
POSTUnderweightNum8BEST. POSTUnderweight
POSTWorkloadNum8BEST. POSTWorkload
POSTalcoholNum8BEST. POSTalcohol
POSTasthmaNum8BEST. POSTasthma
POSTbirthcontrolNum8BEST. POSTbirthcontrol
POSTbreastfedNum8FPOSTBREASTFED. POSTbreastfed
POSTbreastfeed6mNum8BEST. POSTbreastfeed6m
POSTcheckupNum8BEST. POSTcheckup
POSTcholesterolNum8BEST. POSTcholesterol
POSTcigarette3mNum8BEST. POSTcigarette3m
POSTcigarette7mNum8BEST. POSTcigarette7m
POSTcigarettepostpartumNum8BEST. POSTcigarettepostpartum
POSTdateinNum8MMDDYY10. POSTdatein
POSTdatequitsmokingNum8MMDDYY10. POSTdatequitsmoking
POSTdeliveryNum8BEST. POSTdelivery
POSTdevelopNum8BEST. POSTdevelop
POSTdiabetesNum8FPOSTDIABETES. POSTdiabetes
POSTdometicviolenceNum8BEST. POSTdometicviolence
POSTdruguseNum8BEST. POSTdruguse
POSTfamilymemberNum8BEST. POSTfamilymember
POSTfatherNum8BEST. POSTfather
POSTfatherreachableNum8BEST. POSTfatherreachable
POSTfobtNum8BEST. POSTfobt
POSThomelessNum8BEST. POSThomeless
POSThtnNum8FPOSTHTN. POSThtn
POSTinfantIDNum8BEST. POSTinfantID
POSTinfantasthmaNum8BEST. POSTinfantasthma
POSTinfantgainweightNum8BEST. POSTinfantgainweight
POSTinfantthriveNum8BEST. POSTinfantthrive
POSTmentalNum8BEST. POSTmental
POSTothermedChar50$50.$50.POSTothermed
POSTperidontalNum8BEST. POSTperidontal
POSTsickle_cellNum8BEST. POSTsickle cell
POSTtype1Num8BEST. POSTtype1
POSTurinaryinfectionNum8BEST. POSTurinaryinfection
POSTvaginosisNum8BEST. POSTvaginosis
PREACENum8BEST. PREACE
PREBMINum8BEST. PREBMI
PREBR6Num8BEST. PREBR6
PRECESDNum8BEST. PRECESD
PRECigaretteNum8BEST. PRECigarette
PRECigarettebeforeNum8BEST. PRECigarettebefore
PREDateNum8MMDDYY10. PREDate
PREDouchingNum8BEST. PREDouching
PREEDCdateNum8MMDDYY10. PREEDCdate
PREHIVNum8BEST. PREHIV
PREHXofbreastChar2$2.$2.PREHXofbreast
PREHcervixNum8BEST. PREHcervix
PREHdeathNum8BEST. PREHdeath
PREHfetalNum8BEST. PREHfetal
PREHprematureNum8BEST. PREHpremature
PREHpretermNum8BEST. PREHpreterm
PREInsuranceNum8BEST. PREInsurance
PREMonthoflastpregnancyNum8BEST. PREMonthoflastpregnancy
PRENLBWBabyNum8BEST. PRENLBWBaby
PRENmiscarriageNum8BEST. PRENmiscarriage
PRENofathersupportNum8BEST. PRENofathersupport
PREOthersymspecChar42$42.$42.PREOthersymspec
PREOverweightNum8BEST. PREOverweight
PREPSSNum8BEST. PREPSS
PRESTDNum8BEST. PRESTD
PREStaffNum8BEST. PREStaff
PREUnderweightNum8BEST. PREUnderweight
PREWorkloadNum8BEST. PREWorkload
PREalcoholNum8BEST. PREalcohol
PREasthmaNum8BEST. PREasthma
PREdateinNum8MMDDYY10. PREdatein
PREdentalexamNum8BEST. PREdentalexam
PREdiabetesNum8FPREDIABETES. PREdiabetes
PREdometicviolenceNum8BEST. PREdometicviolence
PREdruguseNum8BEST. PREdruguse
PREfamilymemberNum8BEST. PREfamilymember
PREfeetNum8BEST. PREfeet
PREfirstNum8MMDDYY10. PREfirst
PREhighriskNum8BEST. PREhighrisk
PREhomelessNum8BEST. PREhomeless
PREhtnNum8FPREHTN. PREhtn
PREinchNum8BEST. PREinch
PREinfantIDNum8BEST. PREinfantID
PREmentalNum8BEST. PREmental
PREnextNum8MMDDYY10. PREnext
PREnumkidsNum8BEST. PREnumkids
PREnumpregnancyNum8BEST. PREnumpregnancy
PREothermedChar50$50.$50.PREothermed
PREperidontalNum8BEST. PREperidontal
PREsickle_cellNum8BEST. PREsickle cell
PREstageNum8BEST. PREstage
PREtovisitNum8BEST. PREtovisit
PREtype1Num8BEST. PREtype1
PREurinaryinfectionNum8BEST. PREurinaryinfection
PREvaginosisNum8BEST. PREvaginosis
PREweightNum8BEST. PREweight
PREwhyriskChar50$50.$50.PREwhyrisk
PREyearoflastpregnancyNum8BEST. PREyearoflastpregnancy
PedChar49$49.$49.Ped
RaceEthNum8FRACEETH.  
ReenrollNum8BEST. Reenroll
SafehomeNum8BEST. Safehome
SameasmailNum8BEST. Sameasmail
StaffNum8BEST. Staff
StateChar2$2.$2.State
With_childrenNum8BEST. With_children
ZIPChar5$5.$5.ZIP
agegroupNum8**bleep**EGROUP.  
bf6mfuNum8BEST. bf6mfu
birthweighttNum8FBIRTHWEIGHTT.  
county2Char9   
dateinNum8MMDDYY10. datein
dateinspectionNum8MMDDYY10. dateinspection
daterefeNum8MMDDYY10. daterefe
dayNum8BEST. day
deathNum8BEST. death
fatherdaysNum8BEST. fatherdays
fatherreadNum8BEST. fatherread
feedingNum8BEST. feeding
immunizationNum8BEST. immunization
incomegroupNum8FINCOMEGROUP.  
infantIDNum8BEST. infantID
infantgestNum8FINFANTGEST.  
infantweightNum8   
insaddesssChar32$32.$32.insaddesss
insotherNum8BEST. insother
inspolicyChar15$15.$15.inspolicy
insrelationChar7$7.$7.insrelation
insurancenuChar1$1.$1.insurancenu
militarNum8BEST. militar
monthNum8BEST. month
motherdaysNum8BEST. motherdays
motherreadNum8BEST. motherread
parentsdaysNum8BEST. parentsdays
parentsreadNum8BEST. parentsread
schoolChar29$29.$29.school
sourceNum8BEST. source
visitsNum8BEST. visits
weekNum8BEST. week
weeksNum8BEST. weeks
with_parentsNum8BEST. with_parents
with_roommateNum8BEST. with_roommate
with_spouseNum8BEST. with_spouse

 

 

PaigeMiller
Diamond | Level 26

@SM8 

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.

--
Paige Miller
SM8
Obsidian | Level 7 SM8
Obsidian | Level 7
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


PaigeMiller
Diamond | Level 26

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.

 

 

--
Paige Miller
SM8
Obsidian | Level 7 SM8
Obsidian | Level 7

Sorry! I'm still learning how to work the site. But thank you so much, that worked!

SM8
Obsidian | Level 7 SM8
Obsidian | Level 7
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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 7 replies
  • 836 views
  • 0 likes
  • 2 in conversation