I came across the SAS error "ERROR: Width specified for format F is invalid." As that provides absolutely no hint as to what the actual problem is, it took me forever to figure it out.
What I've determined is it's a result of importing a file using proc import. Apparently there is some variable SAS doesn't like in that file (if you know exactly why, I'm all ears).
The solution is to write a "format _all_;" statement in a data step for the file before anything else is done to it. Something like this:
proc import datafile="your file" out=mydataset replace;
run;
data mydataset;
set mydataset;
format _all_;
run;
I hope it helps!
Thank you so much you save me...
ReplyDeleteYour blog is much better than SAS's help.
Thank you again from knoxville, TN!
100% agree.
DeleteYour article saved me!!!
ReplyDeleteWonderful! This was so very helpful. Thanks for the post (and the XKCD cartoon)!
ReplyDeleteThank you, I really appreciate your help. I had the same problem with a Put statement. It was IF F2= " " THEN NAME=PUT(INCIDENT_ID, 35.); that caused the problem. Then I realized that I was creating INCIDENT_ID in that statement. I really needed to use IF F2= " " THEN NAME=PUT(F1, 35.); because I had not named the variables yet.
ReplyDeleteThank you for posting this! This post saved me so much time!!
ReplyDeleteI just typed the error and the link popped up and boom it is solved ..thanks a ton!!
ReplyDeleteThanks! You can also view this in SAS help but credits to you still. :)
ReplyDeleteThank you-- this formatting fix allows me to use my imported SPSS file, but it changes my Date variables to a number (I assume the SAS date number) (eg. upon first import by DOB variable is 25JUL1989:00:00:00 following format DATETIME20. and then I apply the _all_ and it changes to 932947200 following format Best12.). I tried to use formatting code to convert the date variables back to their correct date, but it doesn't work. The formatting is accepted, but the variable remains a the same number (eg. despite successfully applying any number of date formats,eg. Date. or the original date format datetime20. it remains the number 932947200). Do you have any suggestions?
ReplyDeleteI applied format_all_; but all the categories names for categorical variables were replaced with the original numeric codes created in SPSS file. Please help.
ReplyDeleteо да! Thank you very-very much!)
ReplyDeleteIt indeed helped me today when i came across a similar scenario. Thanks for sharing
ReplyDeleteTHANK YOU SO MUCH!
ReplyDeleteThank you very very much
ReplyDeleteThank you so much for making this so easy!
ReplyDeleteYou're welcome! I'm glad that still 7 years later it can be helpful! :-)
DeleteYou have saved my life! Thank you SO much
ReplyDeleteTHANK YOU!!!!!!!!!!!!!!!!!
ReplyDeletesaved my life!!! awesome!
ReplyDeleteWow, very helpful!
ReplyDeleteLife savior! Thank you so much!
ReplyDeleteThank you very much. This is very helpful.
ReplyDeleteIt fixed the problem with merging, but wipes out all formats. I've got some variables with 1-2 dozen formatted values, which were replaced with numbers.
ReplyDeleteMany thanks - completely solved a problem I was struggling with after reading in an SPSS dataset
ReplyDeletesame here. Not happy that I couldn't just wipe the format for the single variable that was causing the problem. But it works for now.
DeleteTHANK YOU!
ReplyDeleteWasted one whole hour trying to read and understand SAS documentation. and then Viola! Thank you from NYC!
ReplyDeletesuper helpful, even 8-9 years after your original posting. Thank you!! :)
ReplyDeleteI just got saved. Thanks
ReplyDelete토토랜 4-pack naija kami game - Online 우리카지노 계열사 우리카지노 계열사 바카라사이트 바카라사이트 クイーンカジノ クイーンカジノ 746BETGames TV Lucky 5 Videos - VntopBet
ReplyDeleteThanks and I have a neat present: Where To Learn Home Renovation complete house renovation cost
ReplyDelete