06-07-2013 04:02 AM
The Program Data Vector (PDV) is a stage in the processing of a SAS data step. SAS first reads the code for a data step and notes all the variables that will be involved at any stage. So all the columns in any tables referenced in Set, Merge or Update statements will be included, plus any reverenced in Format, informat, Length or Attrib statements, in Array statements and the like, not to mention any of the other multiple ways a variable can be defined in SAS; and then it adds a number of automatic variables such as _N_. All of these are allocated enough memory to hold a single complete row of values. This is the PDV.
In executing the data step SAS reads input data (if any) into a buffer which may hold several rows of data; these are then moved or copied in turn into the PDV one by one for processing.
06-10-2013 01:44 AM
Did you find this explanation useful? If so, it would be polite to acknowledge. If not, can you tell me what additional detail would be useful.
You might also like to refer to SAS documentation
06-13-2013 01:35 PM
another PDV question. I am in process of learning SAS-I have been asked to create permanent variable that will save the value of _n_ from PDV into the output data set. I know how to create permanent variable (thanks to your slide show) but do not know how to reference PDV n. Can you help me?
06-13-2013 02:28 PM
The variable _n_ is refered to as _n_ so you code would look like this:
curobsnum = _n_;
Hope this helps,
06-17-2013 01:48 PM
PDV (Program Data Vector) : The information about each of the variables is stored in a reserved area of memory called PDV.
SAS Processes data steps in two stages : (1) Compile Stage (2) Execution Stage
In Compile stage SAS does some housekeeping jobs like to prepare an area to store the sas dataset, then to check input file ( infile statement) to fix various attribute of input file. Then to put all the information at a place in memory called as INPUT BUFFER (where it place each record of data as it is read from the input file).
SAS checks for each variable is character or numeric and the storage length of each variable, this information is called the descriptor portion of the data set.
Descriptor Portion contains : Name of data set, Date and time that the data set was created , Number of observations and the number of variables
(It contains attribute information for each variable in the data set )
SAS does following action during compile stage :
(a) Syntax Scan (b) Sas Source code translation to machine language
(c) Definition of input and output files (d) Create input buffer, PDV and data set descriptor information
(e) Setting the variable attribute for output sas data set. (f) Capture of variables to be initialized to missing.