Hi Team,
I would like to know why if won't work in SAS. can any one please explain the same by using PDV concept.
Note: I am not expecting regular/ standard answers like if statement won't work in proc step.
Thanks & Regards,
Bhanuprakash Pala
IF lets SAS examine current values in the PDV (including values that were calculated along the way, but not part of the incoming data set).
WHERE lets SAS examine the contents of the incoming data, whether or not a PDV exists. In a DATA step, WHERE screens out observations before they get read into the PDV.
PROC steps don't have a PDV, so WHERE is the only choice available.
Please show an example of code which shows how you are trying to use the IF statement (which PROC?), and describe what you mean by "won't work." In general, you can look up the syntax for a PROC in the documentation to see what statements are allowed.
@bhanuprakash wrote:
Hi Team,
I would like to know why if won't work in SAS. can any one please explain the same by using PDV concept.
Note: I am not expecting regular/ standard answers like if statement won't work in proc step.
Thanks & Regards,
Bhanuprakash Pala
Certain PROCs support standard programming statements and some don't. The ones that do, have it identified in the PROC documentation, in Syntax list, under PROGRAMMING STATEMENTS.
PROC PHREG supports programming statements such as IF
In general, most procedures do not support programming statements.
A PROC is essentially a customized procedure designed to accomplish a specific task, where as data step with programming statements are generic and you can do a lot of different data manipulations within the data step.
I would request and suggest you to please refer to text books/sas documentation and various technical papers on this topic, then quote examples with your understanding and elaborate your question with certain references to your examples and understanding to make it precise
IF lets SAS examine current values in the PDV (including values that were calculated along the way, but not part of the incoming data set).
WHERE lets SAS examine the contents of the incoming data, whether or not a PDV exists. In a DATA step, WHERE screens out observations before they get read into the PDV.
PROC steps don't have a PDV, so WHERE is the only choice available.
Many procedures support a separate where statement to subset data.
Data set options are always available.
This is an example of using the data set option where to subset data to only values of 'F' For the variable Sex and rename the existing variable "Name" to "PersonName".
Proc print data = sashelp.class (where= (sex='F') rename=(name=PersonName) );
run;
The where dataset option may have restrictions on uses of functions calculating values.
SAS doesn't say a whole lot about the internal workings of the software. We know that there is additional data movement along the way. For example, a DATA step doesn't read data directly from a SAS data set into the PDV. Rather, it moves a block of data into memory, and then reads observations (one at a time) from that block into the PDV. That's not the real point here ... more to the point is that the real process isn't widely described.
In a PROC step as well, there must be additional data movement along the way. But we don't really know how and where that data movement occurs. As you have noted, however, SAS does have the ability to subset, drop, and rename at some point. We just don't know (at least I just don't know) what the intermediate storage locations are and where the renaming takes place.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.