BookmarkSubscribeRSS Feed
Prateek1
Obsidian | Level 7

Hi,

This is my code :

Proc report data=Olympics.Case7 nowd headline headskip;
Column Probability Nbr_of_optys Tot_Budget Tot_Forecast;
define Probability/Group width=12 descending"Probabilty';
define Tot_Budget/Analysis SUM FORMAT=Dollar15.2"Tot_Budget";
define N/"Nbr_of_optys";
define Tot_Forecast/Computed format=Dollar15.2;
Tot_Forecast=Tot_Budget.sum*Probabilty*0.01;
endcomp;
rbreak after/summarize ;
run;

 i am getting a error:

: Statement is not valid or it is used out of proper order.

3 REPLIES 3
Tim_SAS
Barite | Level 11

Looks like you're missing the COMPUTE statement that should precede Tot_Forecast=Tot_Budget.sum*Probabilty*0.01;

PaulLee
Fluorite | Level 6

You seem to have mis-matching quotes (started using double and ended using single)?

 

define Probability/Group width=12 descending"Probabilty';

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This is a good example of where coding formatting would have highlighted your question - also note there are other typos in that code:

Here the code is fixed - there was unbalanced quotes around Probability, and missing compute line.

proc report data=olympics.case7 nowd headline headskip;
  column probability nbr_of_optys tot_budget tot_forecast;
  define probability  / group width=12 descending "Probabilty";  
  define tot_budget   / analysis sum format=dollar15.2 "tot_budget";
  define n            / "nbr_of_optys";
  define tot_forecast / computed format=dollar15.2;
compute tot_forecast; tot_forecast=tot_budget.sum*probabilty*0.01; endcomp;
rbreak after/summarize ; run;

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1160 views
  • 3 likes
  • 4 in conversation