First time posting on the discussion boards here (I believe).
I continue to encounter the error: "ERROR: Array subscript out of range at line 61 column 31."
The code is as follows:
data conversion; set work.combo2; array original_variables{7} rawsug refsug HFCS glucose dextrose total totalsweet; array conversion_variables{7} rawsug_tbsp refsug_tbsp HFCS_tbsp glucose_tbsp dextrose_tbsp total_tbsp totalsweet_tbsp; do vars= 1-7; conversion_variables{vars} = original_variables{vars}/3; /* This is line 61*/ end; drop vars; run;
ERROR: Array subscript out of range at line 61 column 31. Year=1970 Grains=6.93 Dairy=1.81 Meat_Fish=3.25 Vegetables=3.29 Fruits=1.12 Uspop=205.052 RawSug=37.112167365 RefSug=34.684268565 HFCS=0.1867832418 Glucose=4.7409189704 Dextrose=1.5663774862 Total=6.4940796983 Syrup=0.1695530355 Honey=0.3424306404 TotalSweet=41.690331939 rawsug_tbsp=. refsug_tbsp=. HFCS_tbsp=. glucose_tbsp=. dextrose_tbsp=. total_tbsp=. totalsweet_tbsp=. vars=-6 _ERROR_=1 _N_=1
Looking at the error you can see VARS=-6
Your do statement is incorrect and resolves to
do vars=1-7 -> do vars=-6
You want
do vars=1 to 7;
Looking at the error you can see VARS=-6
Your do statement is incorrect and resolves to
do vars=1-7 -> do vars=-6
You want
do vars=1 to 7;
Thank you for the quick reply. It is much appreciated.
EDIT: That fix worked perfectly!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: