In this question, I rename the numeric variable phone to
numphone and then try use phone=put(numphone,comma16.) to
store the numeric value numphone as a string value in phone.
But I get a warning tha numphone already exists and in the
data sat phone doesnt exist and numphone is set to missing. Why?


data names_and_more;
input Name $20.
Phone : comma16.
Height & $10.
Mixed & $8.;
Name = tranwrd(Name,' ',' ');
rename phone = numphone;
phone = put(numphone,comma16.);
datalines;
Roger Cody 9,087,821,234 5ft. 10in. 50 1/8
Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2
Marco Polo 8,001,234,567 5Ft. 6in. 40
Brian Watson 5,183,551,766 5ft. 10in 89 3/4
Michael DeMarco 4,452,322,233 6ft. 76 1/3
;

Answer Posted / kumaraswamy maduri

Yes you are right.

The way you coded tells the compiler to do two actions
simultaneosly on the PDV. The renaming will be done once
the data step is closed.

data t;
set names_and_more(rename=(phone=numphone));
phone = put(numphone,comma16.);
run;

In the above example which uses the same data that you
gave, this works the way you wanted. Dataset options work
on the dataset not on the PDV.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Enlist the functions performed by sas.

674


What are the data types does SAS contain?

650


State the difference between INFORMAT and FORMAT ?

593


What is the different between functions and PROCs that calculate the same simple descriptive statistics?

1222


What was the last computer book you purchased? Why?

1910






What are the new features included in the new version of SAS Programming Language?

733


How to test the debugging in sas?

606


how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming

598


List out some key concept of SAS

619


In SAS explain which statement does not perform automatic conversions in comparisons?

797


what are the considerations when picking a SAS/STAT procedure?

2896


Describe a time when you were really stuck on a problem and how you solved it?

2082


what r the job openings SAS for fresher graduates !

2013


how does sas handle missing values in a merge? : Sas programming

551


How do you define proc in sas? : sas-grid-administration

670