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

Hello team,

I am not so conversant with SAS but I have been running SAS codes with proc iml but apparently getting these kinds of errors

 
31         /* Especify the number of equations you are estimating*/
32         
33         e=9;
34         
35         
36         
37         /* Especify the equation you drop in the SUR*/
38         
39         d=9;
40         
41         
42         
43         /* Especify the number of socio demographic variables included in the model */
44         
45         r=4;
46         
47         
48         
49         /* Especify the degree of polynomial used in the model*/
50         
51         s=5;
52         
53         
54         
55         /*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2                                                          The SAS System                              11:36 Thursday, June 22, 2017

55       ! */
56         
57         
58         
59         /*/////Importing into matrices Arithmetic mean values for budget shares,price indices and socio demographic
59       ! charact/////*/
60         
61         
62         
63         /*Read the mean values of budget shares*/
64         
65         USE w_means;
66         
67         READ ALL INTO W;
68         
69         W2= W[4,3:e+2];
70         
71         *print w2;
72         
73         
74         
75         /*Read the mean values of price variables*/
76         
77         USE p_means;
78         
79         READ ALL INTO P;
80         
81         P2= P[4,3:e+2];
82         
83         *print p2;
84         
85         
86         
87         /*Read the mean values of demographic variables*/
88         
89         USE sd_means;
90         
91         READ ALL INTO SD;
92         
93         SD2= 1||SD[4,3:r+2];
94         
95         *print sd2;
96         
97         
98         
99         
100        
101        /*/////////////////////////Importing into a matrix the parameter estimates for Beta from the EASI model, where the
101      ! missing
102        
103        parameters are recovered trough the adding up  restriction/////////////////////////////////////////////////////////*/
104        
105        
106        
107        USE beans_excel3;
108        
109        READ ALL VAR {
110        
3                                                          The SAS System                              11:36 Thursday, June 22, 2017

111        b0101 b0102 b0103 b0104 b0105 b0106 b0107 b0108 b0109
112        
113        b0201 b0202 b0203 b0204 b0205 b0206 b0207 b0208 b0209
114        
115        b0301 b0302 b0303 b0304 b0305 b0306 b0307 b0308 b0309
116        
117        b0401 b0402 b0403 b0404 b0405 b0406 b0407 b0408 b0409
118        
119        b0501 b0502 b0503 b0504 b0505 b0506 b0507 b0508 b0509
120        
121        b0601 b0602 b0603 b0604 b0605 b0606 b0607 b0608 b0609
122        
123        b0701 b0702 b0703 b0704 b0705 b0706 b0707 b0708 b0709
124        
125        b0801 b0802 b0803 b0804 b0805 b0806 b0807 b0808 b0809
126        
127        b0901 b0902 b0903 b0904 b0905 b0906 b0907 b0908 b0909
128        
129        
130        } INTO B;
ERROR: B0101 is not in the scope of variables for the data set.

 statement : READ at line 109 column 1
131        
132        
133        
134        B1= J(e-1,e,0);
135        
136        Do i=1 to e-1;
137        
138        j=i-1;
139        
140        M= B[1,1+e*j:e*(j+1)];
141        
142        B1 [i,]= M;
143        
144        end;
ERROR: (execution) Matrix has not been set to a value.

 operation : [ at line 140 column 5
 operands  : B, *LIT1021, _TEM1002, _TEM1004

B      0 row       0 col     (type ?, size 0)


*LIT1021      1 row       1 col     (numeric)

         1

_TEM1002      1 row       1 col     (numeric)

         1

_TEM1004      1 row       1 col     (numeric)

         9

 statement : ASSIGN at line 140 column 1
4                                                          The SAS System                              11:36 Thursday, June 22, 2017

145        
146        *print B1;
147        
148        
149        
150        B2= J(1,e,0);
151        
152        Do i=1 to e;
153        
154        M= -SUM(B1[,i]);
155        
156        B2 [,i] = M;
157        
158        END;
159        
160        *print B2;
161        
162        
163        
164        B3=B1//B2;
165        
166        *print B3;
167        run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
168        
169        GOPTIONS NOACCESSIBLE;
170        %LET _CLIENTTASKLABEL=;
171        %LET _CLIENTPROJECTPATH=;
172        %LET _CLIENTPROJECTNAME=;
173        %LET _SASPROGRAMFILE=;
174        
175        ;*';*";*/;quit;
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      
175      !                run;
176        ODS _ALL_ CLOSE;
177        
178        
179        QUIT; RUN;
180       

 

these are my codes for more information

proc iml;

 

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

 

/* Especify the number of equations you are estimating*/

e=9;

 

/* Especify the equation you drop in the SUR*/

d=9;

 

/* Especify the number of socio demographic variables included in the model */

r=4;

 

/* Especify the degree of polynomial used in the model*/

s=5;

 

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

 

/*/////Importing into matrices Arithmetic mean values for budget shares,price indices and socio demographic charact/////*/

 

/*Read the mean values of budget shares*/

USE w_means;

READ ALL INTO W;

W2= W[4,3:e+2];

*print w2;

 

/*Read the mean values of price variables*/

USE p_means;

READ ALL INTO P;

P2= P[4,3:e+2];

*print p2;

 

/*Read the mean values of demographic variables*/

USE sd_means;

READ ALL INTO SD;

SD2= 1||SD[4,3:r+2];

*print sd2;



 

/*/////////////////////////Importing into a matrix the parameter estimates for Beta from the EASI model, where the missing

parameters are recovered trough the adding up  restriction/////////////////////////////////////////////////////////*/

 

USE beans_excel3;

READ ALL VAR {

b0101 b0102 b0103 b0104 b0105 b0106 b0107 b0108 b0109

b0201 b0202 b0203 b0204 b0205 b0206 b0207 b0208 b0209

b0301 b0302 b0303 b0304 b0305 b0306 b0307 b0308 b0309

b0401 b0402 b0403 b0404 b0405 b0406 b0407 b0408 b0409

b0501 b0502 b0503 b0504 b0505 b0506 b0507 b0508 b0509

b0601 b0602 b0603 b0604 b0605 b0606 b0607 b0608 b0609

b0701 b0702 b0703 b0704 b0705 b0706 b0707 b0708 b0709

b0801 b0802 b0803 b0804 b0805 b0806 b0807 b0808 b0809

b0901 b0902 b0903 b0904 b0905 b0906 b0907 b0908 b0909


} INTO B;

 

B1= J(e-1,e,0);

Do i=1 to e-1;

j=i-1;

M= B[1,1+e*j:e*(j+1)];

B1 [i,]= M;

end;

*print B1;

 

B2= J(1,e,0);

Do i=1 to e;

M= -SUM(B1[,i]);

B2 [,i] = M;

END;

*print B2;

 

B3=B1//B2;

*print B3;
run;

 

I will really appreciate your advise

 James

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Start with your errors in the order they come.

 

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

 

Check if you have a variable called B0101 in your data set, beans_excel3

View solution in original post

3 REPLIES 3
Reeza
Super User

Start with your errors in the order they come.

 

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

 

Check if you have a variable called B0101 in your data set, beans_excel3

jamuriuk
Fluorite | Level 6
Thanks, I actually don't have the B0101 unless I create it. Thanks.
How about the second error, please?
ERROR: (execution) Matrix has not been set to a value.
Reeza
Super User

That depends, did you fix the first error and the second error still exists?

If so, post the new log, up to the error, we don't need all of your code.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1178 views
  • 1 like
  • 2 in conversation