Hi,
I've been using SAS for about a month so far. It's a great tool for Financial analysis and I enjoy using it. My question is regarding if there's a function or a way to output the independents variables that define an dependent one ?
Let's say I have something like this.
Data Test;
Set table_1 (keep= x a b);
y= 2x + ab;
run;
Is there any way SAS could compute from y and output x a b (not the value, the variable name) which are the variables that defines y ? So far I've been running the upper right search bar a lot, and was wondering if there's a more efficient way since our model must have at least 25 distinct programs running.
Cheers,
Kevin
Edit 1: I'm using the search bar for tracking purposes. In that example, I'd search y, until i find the line where it is defined. But I Wonder if there's a way that SAS could output something similar to : x a b are the defining variables of y; instead of tracking them manually by the search bar.
@KBou wrote:
Hi,
I've been using SAS for about a month so far. It's a great tool for Financial analysis and I enjoy using it. My question is regarding if there's a function or a way to output the independents variables that define an dependent one ?
Let's say I have something like this.
Data Test;
Set table_1 (keep= x a b);
y= 2x + ab;
run;
Is there any way SAS could compute from y and output x a b (not the value, the variable name) which are the variables that defines y ? So far I've been running the upper right search bar a lot, and was wondering if there's a more efficient way since our model must have at least 25 distinct programs running.
It's really not clear what you are asking. It's not clear what you are running in the "upper right search bar". Please provide more details, show us exactly what your input is and exactly what output you want.
I'm using the search bar for tracking purposes. In that example, I'd search y, until i find the line where it is defined. But I Wonder if there's a way that SAS could output something similar to : x a b are the defining variables of y; instead of tracking them manually by the search bar.
@KBou wrote:
But I Wonder if there's a way that SAS could output something similar to : x a b are the defining variables of y
Output to what?
Thank you for your help sir, please be indulgent I'm pretty new to this ! I have some issues expressing myself in English. I don't really care about the output type, as long as I have a message, a line, a report,... whatsoever that can trace which data is used for the calculations of this specific variable. This would save me so much time. When a variable appears in 13 programs, it's getting messy to trace back its origins.
Well, you could name the variables differently, such as Y1 through Y13, and then your SAS code determines uniquely how it was created. That seems the simplest thing to me.
I suppose you could also create a record in a data set that says Y1 was created using the formula ... and Y2 was created using the formula etc. But you would have to program this, it's more work than the first suggestion above.
It all depends on exactly what you want and how much effort you want to put into it.
A technique from the previous century: with a program editor that can search many files at once for regular expressions, such as Notepad++, you could search all your SAS programs for the pattern ^\s*\w+\s*= and get a listing of all simple assignments such as:
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.