how can i get the date while i using named input format??
data d;
input id= name=$20. dob=ddmmyy10. sal= desig=$20.;
format dob ddmmyy10.;
cards;
desig=Assistant manager id=100 name=krishna chandran sal=5000 dob=21/09/1989
id=101 dob=10/05/2010 desig=engineer sal=8000 name=hareesh Menon
run;
while i run this code i couldn't view the date in table.Any one can suggest some tips for fixing the problem as soon as possible
Hope this would help you.
I could do it in two steps...
data d;
input id= name=$20. dob=$10. sal= desig=$20.;
cards;
desig=Assistant manager id=100 name=krishna chandran sal=5000 dob=21/09/1989
id=101 dob=10/05/2010 desig=engineer sal=8000 name=hareesh Menon
quit;
data r;
set d;
dob_ = input(dob,ddmmyy10.);
format dob_ ddmmyy10.;
drop dob;
rename dob_ = dob;
run;
Try this..
Lakshmi.
Hope this would help you.
I could do it in two steps...
data d;
input id= name=$20. dob=$10. sal= desig=$20.;
cards;
desig=Assistant manager id=100 name=krishna chandran sal=5000 dob=21/09/1989
id=101 dob=10/05/2010 desig=engineer sal=8000 name=hareesh Menon
quit;
data r;
set d;
dob_ = input(dob,ddmmyy10.);
format dob_ ddmmyy10.;
drop dob;
rename dob_ = dob;
run;
Try this..
Lakshmi.
Hai Lekshmi i got the output with your code..Thanks for your valuable reply
Krishna
Hi,
Well, I have never seen that type of cards statement use before. Unusual. Personally I would agree with Chrishi, one step approach. Firstly define what you want your output dataset to look like - the attrib statements - then have an infile statement to define delimiter (because if you have more than 10 rows of data you don't want to be typing variable names each time - unless you like typing?). Then input the data. This approach would also work entering data into Excel for instance and then importing, just change the infile from cards to a filename.
Thanks RW9 for your valuable information.Am beginner in SAS Technology.I need to learn more from sas
Reagrds
Krishna
No probs. I forgot to actually include the code on my post:
data d;
attrib id format=$20.
name format=$20.
dob format=ddmmyy10. informat=ddmmyy10.
sal format=best.
desig format=$20.;
infile cards delimiter=',';
input id name $ dob sal desig $;
cards;
100,krishna chandran,21/09/1989,5000,assistant manager
101,hareesh menon,10/05/2010,8000,engineer
run;
Thanks i got it
Hi
you have to give informat before the input line for dob that will resolve your problem i hope.
data d;
informat dob ddmmyy10.;
input id= name=$20. dob= sal= desig=$20.;
format dob ddmmyy10.;
cards;
desig=Assistant manager id=100 name=krishna chandran sal=5000 dob=21/09/1989
id=101 dob=10/05/2010 desig=engineer sal=8000 name=hareesh Menon
run;
Thanks,
Sudeer.
Thanks Sudeer.
while i using with your code.The table shown the 3rd observations as filled with period(.)
I also need to get the columns in proper order..How could it possible Sudeer?
Regards
Krishna
Named input can be useful. I would write it like this to define the variables, provide INFORMATS and FORMATS as needed, and get them in the order you desire. Plus it makes you look like you know what you're doing.
thanks i got it
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.