Updating a variable in sas
You can even replace “want” with “need” to get a slightly different flavor.
There are known means of modifying variable attributes with PROC DATASETS, but they are limited to variable name, format, informat, and label.
The following figure shows the results of updating a SAS data set.
So think of the places where you’ll require an UPDATE.
First, we will create cost so that it gives us the price in thousands of dollars.
Then we will create mpgpd which will stand for miles per gallon per thousand dollars.
Update and Modify are two underused statements in SAS programming language, but the questions regarding the working of each and the differences between them is a heavily asked question in SAS interviews, the latter one being more frequent.
We will create one new variable to go along with the existing ones. Since a missing value is also less than 20, the missing values got recoded to 0 as well.
For complete working of these please visit SAS website.
MISSINGCHECK, then blankvalues in a transaction dataset will not replace current values in a master data set.
But what if we want/need to modify a variable length, or change a variable type?
And I am not talking about creating a new variable with a different length or converting a numeric variable value into a character value of another variable.