BookmarkSubscribeRSS Feed
goliPSU
Calcite | Level 5

I am receiving the following error message:

1610      read all var{fuel_r_&Yr} into fuel_r;

ERROR: FUEL_R_ is not in the scope of variables for the data set.

statement : READ at line 1610 column 5

for running the following command:

use UTIL_RETAIL;

read all var{elec_r_&Yr} into elec_r;
read all var{fuel_r_&Yr} into fuel_r;

any comments?

4 REPLIES 4
Rick_SAS
SAS Super FREQ

Looks like &Yr is not defined. Use %put &Yr to find out.

goliPSU
Calcite | Level 5

Actually Yr is defined earlier:

proc iml;

%let Yr = '93';

    *%include 'sector_codes Nov 25 08.sas';

     %include 'C:\Users\hze1\Desktop\SAS\FoodChain\sector_codes.sas';

    %macro addmargins(fob,truck,rail,water,air,pipe,whole,ret,filter=(1:num_sectors));

        selector = J(1,num_sectors,0);

        selector[&filter] = 1;

        Yplus = diag(selector) * &fob;

        /* transportation margins */

        Yplus[truck_row,] = Yplus[truck_row,] + selector * &truck;

        Yplus[air_row,] = Yplus[air_row,] + selector * &air;

        Yplus[water_row,] = Yplus[water_row,] + selector * &water;

        Yplus[rail_row,] = Yplus[rail_row,] + selector * &rail;

        Yplus[pipe_row,] = Yplus[pipe_row,] + selector * &pipe;

        /* wholesale & retail utility and non-utility expenditure */

        Yplus[tgas_row,] = Yplus[tgas_row,] +

            selector * (diag(fuel_w) * &whole + diag(fuel_r) * &ret);

        Yplus[telec_row,] = Yplus[telec_row,] +

            selector * (diag(elec_w) * &whole + diag(elec_r) * &ret);

        Yplus[whole_row,] = Yplus[whole_row,] +

            selector * ((I(num_sectors) - diag(elec_w + fuel_w)) * &whole);

        Yplus[retail_row,] = Yplus[retail_row,] +

            selector * ((I(num_sectors) - diag(elec_r + fuel_r)) * &ret);

    %mend;

    /* GET DATA */

    use UTIL_RETAIL;

    read all var{elec_r_&Yr} into elec_r;

    read all var{fuel_r_&Yr} into fuel_r;

Rick_SAS
SAS Super FREQ

Use

%let Yr = 93;

instead of

%let Yr = '93';

goliPSU
Calcite | Level 5

Thank you.

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 1235 views
  • 1 like
  • 2 in conversation