Hello All,
I am trying to transpose some stock data that I generated in R. There are two entries for one stock symbol, I will attach the photo so that you may be able to understand better what I am saying. All I want is one row, not two, for each stock symbol.
I have tried this
proc transpose data=pa.regression_stats out=pa.transposed_data;
by Var;
var estimate p_value statistic std_error;
run;
But it does the exact opposite of what I want, converting it into four rows instead of two
A merge is probably easier for this one IMO.
data want;
merge have (where=( term = '(Intercept)'))
have (where=( term = 'VFINX') rename = (estimate = vfinx_est std_error = vfinx_std_error statistic = vfinx_stat));
by Var;
run;
@skatethejake wrote:
Hello All,
I am trying to transpose some stock data that I generated in R. There are two entries for one stock symbol, I will attach the photo so that you may be able to understand better what I am saying. All I want is one row, not two, for each stock symbol.
I have tried this
proc transpose data=pa.regression_stats out=pa.transposed_data; by Var; var estimate p_value statistic std_error; run;
But it does the exact opposite of what I want, converting it into four rows instead of two
A merge is probably easier for this one IMO.
data want;
merge have (where=( term = '(Intercept)'))
have (where=( term = 'VFINX') rename = (estimate = vfinx_est std_error = vfinx_std_error statistic = vfinx_stat));
by Var;
run;
@skatethejake wrote:
Hello All,
I am trying to transpose some stock data that I generated in R. There are two entries for one stock symbol, I will attach the photo so that you may be able to understand better what I am saying. All I want is one row, not two, for each stock symbol.
I have tried this
proc transpose data=pa.regression_stats out=pa.transposed_data; by Var; var estimate p_value statistic std_error; run;
But it does the exact opposite of what I want, converting it into four rows instead of two
Have represents your input data set. Replace it with your data set name.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.