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

Everything was fine until I ran the following code:

 

%macro cb_summary (cur, reg, code);

proc means data= &cur._c_&reg._&code. noprint;
class Event;
output out= S&cur._c_&reg._&code.;
run;

data S&cur._c_&reg._&code.;
set S&cur._c_&reg._&code.;

if _TYPE_= 1;
run;

%if &code.= 1 %then %do;
proc means data= &cur._c_&reg._&code. noprint;
class Event Year;
output out= YS&cur._c_&reg._&code.;
run;

data YS&cur._c_&reg._&code.;
set YS&cur._c_&reg._&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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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_&reg._&code.;
run;

Removing formats:

data YS&cur._c_&reg._&code.;
    set YS&cur._c_&reg._&code.;

*removes all formats from numeric variables;
format _numeric_;
run;

 

View solution in original post

15 REPLIES 15
d6k5d3
Pyrite | Level 9
@pink_poodle,

Thank you for your reply. However, unfortunately I cannot relate his code with mine. So I am still confused.
pink_poodle
Barite | Level 11
Basically, they added a format statement to the Proc Means step. Explicitly specifying the format of variables helped override the default width that produced the asterisk error.
d6k5d3
Pyrite | Level 9

But I have not received any error for the following code:

 

%macro eco_summary (cur, reg);

proc means data= &cur._E_&reg. noprint;
class Event;
output out= S&cur._E_&reg.;
run;

data S&cur._E_&reg.;
set S&cur._E_&reg.;

if _TYPE_= 1;
run;

proc means data= &cur._E_&reg. noprint;
class Event Year;
output out= YS&cur._E_&reg.;
run;

data YS&cur._E_&reg.;
set YS&cur._E_&reg.;

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.

Tom
Super User Tom
Super User

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.

d6k5d3
Pyrite | Level 9
Because I never got these NOTE and ERROR before in log:


NOTE: Table has been opened in browse mode.
ERROR: Asterisks are an indication of a format width problem.

Why would there be asterisks?
SASKiwi
PROC Star

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.

Reeza
Super User

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_&reg._&code. noprint;
class Event;
output out= S&cur._c_&reg._&code.;
run;

data S&cur._c_&reg._&code.;
set S&cur._c_&reg._&code.;

if _TYPE_= 1;
run;

%if &code.= 1 %then %do;
proc means data= &cur._c_&reg._&code. noprint;
class Event Year;
output out= YS&cur._c_&reg._&code.;
run;

data YS&cur._c_&reg._&code.;
set YS&cur._c_&reg._&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.


 

 

d6k5d3
Pyrite | Level 9

@SASKiwi@Reeza, Please see the log:

 

1062  %macro cb_summary (cur, reg, code);
1063
1064  proc means data= &cur._c_&reg._&code. nway noprint;
1065  class Event;
1066  output out= S&cur._c_&reg._&code.;
1067  run;
1068
1069  /*data S&cur._c_&reg._&code.;
1070  set S&cur._c_&reg._&code.;
1071
1072  if _TYPE_= 1;
1073  run;*/
1074
1075  %if &code.= 1 %then %do;
1076  proc means data= &cur._c_&reg._&code. nway noprint;
1077  class Event Year;
1078  output out= YS&cur._c_&reg._&code.;
1079  run;
1080
1081  /*data YS&cur._c_&reg._&code.;
1082  set YS&cur._c_&reg._&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.

SASKiwi
PROC Star

@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?

d6k5d3
Pyrite | Level 9
I use SAS Windowing Environment. Some Years and _Type_s are shown to have asterisks instead of actual values.
Reeza
Super User

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_&reg._&code.;
run;

Removing formats:

data YS&cur._c_&reg._&code.;
    set YS&cur._c_&reg._&code.;

*removes all formats from numeric variables;
format _numeric_;
run;

 

d6k5d3
Pyrite | Level 9
Yes, I figured out. It was a 'length' issue. Thanks for all the input.
Reeza
Super User

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: Register Now

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!

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
  • 15 replies
  • 3511 views
  • 5 likes
  • 5 in conversation