BookmarkSubscribeRSS Feed
Juan_Jose
Calcite | Level 5

Hello,  I have a code that was handled to me and I'm reviewing, I did not wrote the code.  I encontared several error in the following code, I am new to this function and can't figure out what is the fix, I would very much appreciate your help 

 

 

proc sgplot data = seg_tmp.all_v2;
format MNTH_SMRY_START_DT dtmonyy.
styleattrs
datacolors=(VIGB VLIGB orange)
DATACONTRASTCOLORS = (orange blue black);
vline MNTH_SMRY_START_DT / response=tot_trans_am grouporder=data stat=mean lineattrs=(thickness=2 PATTERN =solid);
vline MNTH_SMRY_START_DT / response=tot_trans_am grouporder=data stat=median y2axis lineattrs=(thickness=2 PATTERN =solid);
label MNTH_SMRY_START_DT = 'Month';
y2axis label='Median Transaction Amount';
yaxis label = 'Mean Transaction Amount';
xaxis label = 'Month';
by seg;
run;

 

And the error are as follows:

 

proc sgplot data = seg_tmp.all_v2;
 format MNTH_SMRY_START_DT dtmonyy.
 styleattrs
 datacolors=(VIGB VLIGB orange)
                  -                                  -
                 22                               22
                200                             200

 DATACONTRASTCOLORS = (orange blue black);
                                                                                -
                                                                               22
                                                                              200
WARNING: Variable STYLEATTRS not found in data set SEG_TMP.ALL_V2.
WARNING: Variable DATACOLORS not found in data set SEG_TMP.ALL_V2.
WARNING: Variable VIGB not found in data set SEG_TMP.ALL_V2.
WARNING: Variable VLIGB not found in data set SEG_TMP.ALL_V2.
WARNING: Variable ORANGE not found in data set SEG_TMP.ALL_V2.
WARNING: Variable ORANGE not found in data set SEG_TMP.ALL_V2.
WARNING: Variable BLUE not found in data set SEG_TMP.ALL_V2.
WARNING: Variable BLACK not found in data set SEG_TMP.ALL_V2.
ERROR 22-322: Syntax error, expecting one of the following: a name, a format name, ;, -, :, _ALL_, _CHARACTER_, _CHAR_,
_NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.
 vline MNTH_SMRY_START_DT / response=tot_trans_am grouporder=data stat=mean lineattrs=(thickness=2 PATTERN
! =solid);
 vline MNTH_SMRY_START_DT / response=tot_trans_am grouporder=data stat=median y2axis lineattrs=(thickness=2
                                                                                                                                 ------
                                                                                                                                  22
                                                                                                                                  76
 ! PATTERN =solid);
ERROR 22-322: Syntax error, expecting one of the following: FREQ, MEAN, SUM.
ERROR 76-322: Syntax error, statement will be ignored.
 label MNTH_SMRY_START_DT = 'Month';
 y2axis label='Median Transaction Amount';
 yaxis label = 'Mean Transaction Amount';
 xaxis label = 'Month';
 by seg;
 run;

2 REPLIES 2
Rick_SAS
SAS Super FREQ

I believe the code was written with a recent version of SAS and you are running it on an older version. The error that says 

ERROR 22-322: Syntax error, expecting one of the following: FREQ, MEAN, SUM.

indicates that STAT=MEDIAN is not support on your version of SAS. 

 

I think the DATACOLORS= option was added in SAS 9.4M3.

The STAT=MEDIAN option is relatively new...maybe SAS 9.4M5.

ballardw
Super User

Also

proc sgplot data = seg_tmp.all_v2;
format MNTH_SMRY_START_DT dtmonyy.      <= no ;  for format statement so styleattrs is treated as the next variable to apply a format to 
styleattrs
datacolors=(VIGB VLIGB orange)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 660 views
  • 0 likes
  • 3 in conversation