Date: Thu, 13 Sep 2001 11:08:23 -0400
Reply-To: "David L. Ward" <dward@SASHELP.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Ward" <dward@SASHELP.COM>
Subject: Re: input, inputc, inputn, put, putc, putn
The difference b/w put and putn,putc (and likewise input) is in how you
call the functions. put is called with the format name as the second
argument WITHOUT quotes around it. Thus at compile time SAS checks to make
sure the format is valid. putn and putc, on the other hand, accept a valid
string, which could be a variable or concatenation, as the second
argument. This is helpful when your format could change, for example the
length of the format you want to use could change. Here is some sample
code:
x=put(date(),date9.);
x=putn(date(),'date9.');
fmt='date9.';
x=putn(date(),fmt);
Now to the matter of putn vs. putc. putn expects a numeric first argument
and a numeric format and returns a character result. putc expects a
character first argument and character format and returns a character
result. inputn expects a character first argument and numeric informat and
returns a number. inputc expects a character first argument and a
character informat and returns a character expression. Here are samples:
x=input('8',best32.);
x=inputn('8','best32.');
x=inputc('55','$hex2.');
fmt='$'||trim(fmtVar)||compress(length(y));
x=inputc('55',fmt);
You can usually get by with simply put and input
Hope this helps!
David Ward
SASHelp.com
>-----Original Message-----
>From: Karl Ruertenberg [mailto:karl________@HOTMAIL.COM]
>Sent: 13. september 2001 14:53
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: input, inputc, inputn, put, putc, putn
>
>
>hi all, what is the difference among input, inputc, inputn? what is the
>difference among put, putc, putn? to translate a numeric value 1 to, say, a
>numeric value 9 by user-defined format, what function to use? to translate
a
>character value a to, say, a character value z by user-defined format, what
>function to use? tia!!!!!
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|