Variable and Dataset Confusion

#1
I have imported an Excel spreadsheet into SAS as WORK.X1. I am trying these lines:

proc freq data = x1 ;
data x2 ;
PhysicalAggression = (Aggress9 + Aggress10 + Aggress11 + Aggress12) /4 ;
run;

The log tells me that the Aggress variables are uninitialized. I guess this means that the attention of SAS has shifted from x1 to x2, where it finds no such variables? This is why the output contains information for the Aggress variables but not for PhysicalAggression?

If I delete the "data x2" line, I get an error indicating that PhysicalAggression is not valid or is used out of order. This is perhaps because there is no column in the Excel input labeled PhysicalAggression?

Needless to say, I'd like to be able to proceed to use PhysicalAggression -- the variable, I mean. But I'm stuck.

I have a bit of acquaintance with variables, but the guides I've found are pretty opaque for me. I wouldn't mind buying a beginner's guide to SAS syntax, but in the interests of time would be especially interested in something available now online.

Thanks.
 

hlsmith

Less is more. Stay pure. Stay poor.
#2
I would open up this temporary dataset in SAS and see what it looks like. Click on the View tab, then Explorer, then Work, then the file name. See if it is getting read in correctly. You may also want to do a proc contents.
 
#3
The dataset looks OK. Like I say, I do get output for the Aggress variables. It seems to be more an issue of not knowing how to refer to the data fields and variables.