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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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