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

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 Screen Shot 2020-08-25 at 3.07.45 PM.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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 Screen Shot 2020-08-25 at 3.07.45 PM.png

 

 


 

View solution in original post

3 REPLIES 3
Reeza
Super User

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 Screen Shot 2020-08-25 at 3.07.45 PM.png

 

 


 

skatethejake
Fluorite | Level 6
What does the have represent? Is that just a keyword? Do I have set this data to my previous data?
Reeza
Super User

Have represents your input data set. Replace it with your data set name.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 607 views
  • 0 likes
  • 2 in conversation