Everything was fine until I ran the following code:
%macro cb_summary (cur, reg, code);
proc means data= &cur._c_®._&code. noprint;
class Event;
output out= S&cur._c_®._&code.;
run;
data S&cur._c_®._&code.;
set S&cur._c_®._&code.;
if _TYPE_= 1;
run;
%if &code.= 1 %then %do;
proc means data= &cur._c_®._&code. noprint;
class Event Year;
output out= YS&cur._c_®._&code.;
run;
data YS&cur._c_®._&code.;
set YS&cur._c_®._&code.;
if _TYPE_= 3;
run;
%end;
%mend cb_summary;
%cb_summary (HUF, HUN, 1);
%cb_summary (HUF, HUN, 2);
%cb_summary (HUF, US, 1);
%cb_summary (HUF, US, 2);
I also get these 2 lines in log:
NOTE: Table has been opened in browse mode.
ERROR: Asterisks are an indication of a format width problem.
What is wrong, or where did I go wrong???
Much thanks.
Are you working on a laptop? Have you made the column wider in the view or have you set any formats on the data?
Run a proc contents on the OUTPUT data set and show the formats. You can try making them bigger or removing them entirely to see if it helps as well.
PROC CONTENTS:
proc contents data=YS&cur._c_®._&code.;
run;
Removing formats:
data YS&cur._c_®._&code.;
set YS&cur._c_®._&code.;
*removes all formats from numeric variables;
format _numeric_;
run;
Here is a related post about the asterisks error:
But I have not received any error for the following code:
%macro eco_summary (cur, reg);
proc means data= &cur._E_®. noprint;
class Event;
output out= S&cur._E_®.;
run;
data S&cur._E_®.;
set S&cur._E_®.;
if _TYPE_= 1;
run;
proc means data= &cur._E_®. noprint;
class Event Year;
output out= YS&cur._E_®.;
run;
data YS&cur._E_®.;
set YS&cur._E_®.;
if _TYPE_= 3;
run;
%mend eco_summary;
%eco_summary (HUF, HUN);
%eco_summary (HUF, US);
So, I am not understanding the reasoning behind specifying the format of variables.
Regards.
Why would you WANT to open a dataset in EDIT mode? I don't recommend trying to use SAS as a data editor. If you want to edit the data edit the raw form and re-run the data step that creates a dataset from the raw data.
I do not understand how the subject line relates to the body of your question.
Which step is giving this note and error?
Please add the SAS option MPRINT
options mprint;
to the start of your program, run it and post the SAS log.
Nothing in your code generates any output or opens a window. I suspect this error is from somewhere else in your code. If you still believe otherwise post your log when you’ve added the MPRINT option.
You should look up the NWAY option so you can avoid your second step in each of the PROC MEANS.
@d6k5d3 wrote:
Everything was fine until I ran the following code:
%macro cb_summary (cur, reg, code); proc means data= &cur._c_®._&code. noprint; class Event; output out= S&cur._c_®._&code.; run; data S&cur._c_®._&code.; set S&cur._c_®._&code.; if _TYPE_= 1; run; %if &code.= 1 %then %do; proc means data= &cur._c_®._&code. noprint; class Event Year; output out= YS&cur._c_®._&code.; run; data YS&cur._c_®._&code.; set YS&cur._c_®._&code.; if _TYPE_= 3; run; %end; %mend cb_summary; %cb_summary (HUF, HUN, 1); %cb_summary (HUF, HUN, 2); %cb_summary (HUF, US, 1); %cb_summary (HUF, US, 2);
I also get these 2 lines in log:
NOTE: Table has been opened in browse mode.
ERROR: Asterisks are an indication of a format width problem.
What is wrong, or where did I go wrong???
Much thanks.
@SASKiwi, @Reeza, Please see the log:
1062 %macro cb_summary (cur, reg, code);
1063
1064 proc means data= &cur._c_®._&code. nway noprint;
1065 class Event;
1066 output out= S&cur._c_®._&code.;
1067 run;
1068
1069 /*data S&cur._c_®._&code.;
1070 set S&cur._c_®._&code.;
1071
1072 if _TYPE_= 1;
1073 run;*/
1074
1075 %if &code.= 1 %then %do;
1076 proc means data= &cur._c_®._&code. nway noprint;
1077 class Event Year;
1078 output out= YS&cur._c_®._&code.;
1079 run;
1080
1081 /*data YS&cur._c_®._&code.;
1082 set YS&cur._c_®._&code.;
1083
1084 if _TYPE_= 3;
1085 run;*/
1086 %end;
1087
1088 %mend cb_summary;
1089
1090 options mprint;
1091
1092 %cb_summary (HUF, HUN, 1);
MPRINT(CB_SUMMARY): proc means data= HUF_c_HUN_1 nway noprint;
MPRINT(CB_SUMMARY): class Event;
MPRINT(CB_SUMMARY): output out= SHUF_c_HUN_1;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_HUN_1.
NOTE: The data set WORK.SHUF_C_HUN_1 has 5 observations and 28 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.83 seconds
cpu time 0.39 seconds
MPRINT(CB_SUMMARY): proc means data= HUF_c_HUN_1 nway noprint;
MPRINT(CB_SUMMARY): class Event Year;
MPRINT(CB_SUMMARY): output out= YSHUF_c_HUN_1;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_HUN_1.
NOTE: The data set WORK.YSHUF_C_HUN_1 has 60 observations and 28 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.37 seconds
cpu time 0.46 seconds
1093 %cb_summary (HUF, HUN, 2);
MPRINT(CB_SUMMARY): proc means data= HUF_c_HUN_2 nway noprint;
MPRINT(CB_SUMMARY): class Event;
MPRINT(CB_SUMMARY): output out= SHUF_c_HUN_2;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_HUN_2.
NOTE: The data set WORK.SHUF_C_HUN_2 has 10 observations and 16 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.56 seconds
cpu time 0.28 seconds
1094 %cb_summary (HUF, US, 1);
MPRINT(CB_SUMMARY): proc means data= HUF_c_US_1 nway noprint;
MPRINT(CB_SUMMARY): class Event;
MPRINT(CB_SUMMARY): output out= SHUF_c_US_1;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_US_1.
NOTE: The data set WORK.SHUF_C_US_1 has 10 observations and 29 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.83 seconds
cpu time 0.36 seconds
MPRINT(CB_SUMMARY): proc means data= HUF_c_US_1 nway noprint;
MPRINT(CB_SUMMARY): class Event Year;
MPRINT(CB_SUMMARY): output out= YSHUF_c_US_1;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_US_1.
NOTE: The data set WORK.YSHUF_C_US_1 has 70 observations and 29 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.38 seconds
cpu time 0.45 seconds
1095 %cb_summary (HUF, US, 2);
MPRINT(CB_SUMMARY): proc means data= HUF_c_US_2 nway noprint;
MPRINT(CB_SUMMARY): class Event;
MPRINT(CB_SUMMARY): output out= SHUF_c_US_2;
MPRINT(CB_SUMMARY): run;
NOTE: There were 841896 observations read from the data set WORK.HUF_C_US_2.
NOTE: The data set WORK.SHUF_C_US_2 has 10 observations and 16 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.55 seconds
cpu time 0.28 seconds
NOTE: Table has been opened in browse mode.
ERROR: Asterisks are an indication of a format width problem.
ERROR: Asterisks are an indication of a format width problem.
ERROR: Asterisks are an indication of a format width problem.
ERROR: Asterisks are an indication of a format width problem.
By the way, I get the following NOTE and ERROR in the log only when I double-click the result dataset to view. I mean to say that these NOTE and ERROR do not appear during the time the codes run.
@d6k5d3 - Given your SAS program produces a log without warnings or errors I would say there is nothing inherently "wrong" with it.
What SAS client interface are you using? SAS Windowing Environment (aka Display Manager), Enterprise Guide or SAS Studio? Does the dataset view window open OK and if so which columns display asterisks?
Are you working on a laptop? Have you made the column wider in the view or have you set any formats on the data?
Run a proc contents on the OUTPUT data set and show the formats. You can try making them bigger or removing them entirely to see if it helps as well.
PROC CONTENTS:
proc contents data=YS&cur._c_®._&code.;
run;
Removing formats:
data YS&cur._c_®._&code.;
set YS&cur._c_®._&code.;
*removes all formats from numeric variables;
format _numeric_;
run;
By the way, I get the following NOTE and ERROR in the log only when I double-click the result dataset to view. I mean to say that these NOTE and ERROR do not appear during the time the codes run.
I think that has something to do with your view settings and preference then and nothing to do with your code. Review your settings and preferences and verify you haven't changed any of the defaults. Or tech support may be able to tell you. It would definitely help to mention facts like that from the beginning as well.
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.