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

Describe the types of SAS programming tasks that you performed like Tables? Listings? Graphics? Ad hoc reports? Other?

4 Answers   HP, Oracle,


what is the difference between proc means and proc summary?

2 Answers   Accenture,


here is a string like chq.2312244%4452- from that i want only special characters in a column. dont use compress. bcoz i have 1.2 billion of records.i want another process to find the values instant from the data.

2 Answers   Cap Gemini, L&T,


Write SAS codes to compare two datasets. Suppose the allowable difference is 0.1.

2 Answers  


how can get the first and last observations in a dataset using Proc SQl?

4 Answers   Satyam,


i have a macro variable var1,var2. i want titles for the each macro variable separately? how it is possible?

1 Answers   L&T,


Hi Friends, Am Priya,new to your forum. am looking for Interview questions on SAS Platform Administration. I searched everywhere but I couldn't find them,please can anyone help me with complete interview questions normally everyone will face in the interviews on SAS Administration. am really facing problems in the interviews,am not able to answer any of their questions. I would really appreciate all your help if you can email the complete Interview Questions to priyafeb84@gmail.com Kindly awaiting for your reply with eager

0 Answers  


Which date functions advances a date time or date/time value by agiven interval?

3 Answers  


· What are some good SAS programming practices for processing very large data sets?

6 Answers   Quintiles,


What is the purpose of using the N=PS option?

2 Answers   Oracle,


Can you continue to write code while the rest of the people on the floor where you work have a noisy party to which you were not invited?

2 Answers   Oracle,


What is the difference between an informat and a format. Name three informats or formats.

6 Answers  


Categories