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
;



In this question, I rename the numeric variable phone to numphone and then try use phone=put(numpho..

Answer / 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

More SAS Interview Questions

I have a dataset with variables empid and doj how to calculate retirement age?

1 Answers  


Name statements that are execution only.

14 Answers   Accenture,


What are the functions which are used for character handling functions?

0 Answers  


what are the categories that sas informats are used to the place the data? : Sas-administrator

0 Answers  


What do you know about symput and symget?

0 Answers  






what is sas olap server? : Sas-di

0 Answers  


The below code we are using for creating more than one macro variables in proc sql using into clause. How we can use same code to create macro variables vara, varb, varc instead of var1, var2, var3.? proc sql noprint; select count(distinct(patient)) into :var1 - :var3 from dataset1 group by trtreg1c ; quit;

1 Answers   Accenture,


i have a data set with 20 observations i want label from 8 to 15 observations ? how you create this one.

6 Answers   CTS,


Hi, If anyone has base SAS certification dumps, please share.

0 Answers  


what is fact table and factless table?

1 Answers  


name the scheduler for scheduling job and explain the scheduler? : Sas-di

0 Answers  


Have you ever used the SAS Debugger?

0 Answers   Quintiles,


Categories