This is a newbie SAS question. I have a dataset with numerical variables v1-v120
, V
and a categorical variable Z
(with say three possible values). For each possible value of Z
, I would like to get another set of variables w1-w120
, where w{i}=sum(v{i}}/V
, where the sum is a sum over a given value of Z
. Thus I am looking for 3*120 matrix in this case. I can do this in data step, but would like to do it by Proc SQL
or Proc MEANS
, as the number of categorical variables in the actual dataset is moderately large. Thanks in advance.
相关问题
- Delete the group that none of its observation cont
- Reading data from a SAS data source in .Net
- Simple way to do a weighted hot deck imputation in
- Problems with SAS DDE with Office 2010
- Reading observations from SAS dataset into arrays
相关文章
- Finding all possible paths in a dataset using sas
- How do I save a TextEdit (mac) file with a custom
- Logical function in SAS to determine if a particul
- Efficiently concatenate many sas datasets
- Python sas7bdat module usage
- PROC SQL in SAS - All Pairs of Items
- How to summarize all possible combinations of vari
- Tell SAS not to add newly generated tables on the
Here's a solution using proc sql. You could probably also do something similar with proc means using an output dataset and a 'by' statement.
It's easy to do this with
proc means
. Using thet1
data set from Louisa Grey's answer:This creates an table of results that match the SQL results.