Hi, I am a student and learning how to use SAS by replicating the result from a published paper. I faced a long list of "ERROR: Asterisks are an indication of a format width problem". As you can see from the screenshot, there are some that are calculated corrected, but most of the variables are indicated with asterisks. What I am trying to do is to do a sum up for each variable (28 in total) by year. I am not sure whether it is due to some of the variables have format as numeric 1. while some are in numeric best12. But this is not the case when I check those that managed to sum up, they are a mixture of both numeric formats.
The following is my codes with the variables in red.
proc sort data=sas.governancedropt1;
by year;
run;
proc means data=sas.governancedropt1 noprint;
var BLANKCHECK CBOARD LSPMT LWCNST COMPPLAN DIRIND DIRLIAB GOLDENPARACHUTE SEVERANCE CUMVOTE
CUMVOTESS LABYLW LACHTR SECRETBALLOT SUPERMAJOR UNEQVOTE ANTIGREEN DUTIESNF FAIRPRICE PPARACHUTE
PPILL SPARACHUTE SL_BUSCOMP SL_CASHOUT SL_CSA SL_DUTIES SL_FAIRPRICE SL_RPROFITS;
output out=governancedropt1_byyear (drop=_type_ _freq_)
sum(BLANKCHECK CBOARD LSPMT LWCNST COMPPLAN DIRIND DIRLIAB GOLDENPARACHUTE SEVERANCE CUMVOTE
CUMVOTESS LABYLW LACHTR SECRETBALLOT SUPERMAJOR UNEQVOTE ANTIGREEN DUTIESNF FAIRPRICE PPARACHUTE
PPILL SPARACHUTE SL_BUSCOMP SL_CASHOUT SL_CSA SL_DUTIES SL_FAIRPRICE SL_RPROFITS)
= BLANKCHECK1 CBOARD1 LSPMT1 LWCNST1 COMPPLAN1 DIRIND1 DIRLIAB1 GOLDENPARACHUTE1 SEVERANCE1 CUMVOTE1
CUMVOTESS1 LABYLW1 LACHTR1 SECRETBALLOT1 SUPERMAJOR1 UNEQVOTE1 ANTIGREEN1 DUTIESNF1 FAIRPRICE1 PPARACHUTE1
PPILL1 SPARACHUTE1 SL_BUSCOMP1 SL_CASHOUT1 SL_CSA1 SL_DUTIES1 SL_FAIRPRICE1 SL_RPROFITS1;
by year;
run;
Perhaps this will work:
proc means.......
format
BLANKCHECK1 CBOARD1 LSPMT1 LWCNST1 COMPPLAN1 DIRIND1 DIRLIAB1 GOLDENPARACHUTE1 SEVERANCE1 CUMVOTE1
CUMVOTESS1 LABYLW1 LACHTR1 SECRETBALLOT1 SUPERMAJOR1 UNEQVOTE1 ANTIGREEN1 DUTIESNF1 FAIRPRICE1 PPARACHUTE1
PPILL1 SPARACHUTE1 SL_BUSCOMP1 SL_CASHOUT1 SL_CSA1 SL_DUTIES1 SL_FAIRPRICE1 SL_RPROFITS1 8.;
var...........
SAS assumes the format of a variable if it is not explicitly defined.
Often if a variable has a permanent format assigned then procedures will attempt to use that format by default, such as means or VIEWTABLE.
Try
Proc print data=governancedropt1_byyear;
format _numeric_ best8. ;
run;
and see if that will get closer to what you are looking for.
or turn of the noprint.
You can also change the view within viewtable by clicking on the column heading and editing the format but if you have enough variables that's a tad tedious. You can also use proc datasets to change the format(s) of variables in place either on the input data set or the result.
Perhaps this will work:
proc means.......
format
BLANKCHECK1 CBOARD1 LSPMT1 LWCNST1 COMPPLAN1 DIRIND1 DIRLIAB1 GOLDENPARACHUTE1 SEVERANCE1 CUMVOTE1
CUMVOTESS1 LABYLW1 LACHTR1 SECRETBALLOT1 SUPERMAJOR1 UNEQVOTE1 ANTIGREEN1 DUTIESNF1 FAIRPRICE1 PPARACHUTE1
PPILL1 SPARACHUTE1 SL_BUSCOMP1 SL_CASHOUT1 SL_CSA1 SL_DUTIES1 SL_FAIRPRICE1 SL_RPROFITS1 8.;
var...........
SAS assumes the format of a variable if it is not explicitly defined.
Jwillis, thanks for your help, it works. And I have transpose the data to replicate a data table that I am learning from.
1) How do I get sub headings? eg, as in the screenshot, I need "delay" to indicate it is the heading for blank check-written consent etc...
2) How to add in another row "number of firms" at the bottom of the table?
I have the same problem with indicator variables that I build, where I spesify the format as "1." and then the proc means gives me issues.
What you can do, though I do not know of any consequences of this:
proc means data= a;
format _all_;
informat _all_;
class xxx;
var yyy;
output out=b sum=yyy;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.