| Date: | Sat, 23 Jun 2007 14:54:39 +0200 |
| Reply-To: | SAS-L List <sas-l@listserv.uga.edu> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Robert Bardos <bardos2@ANSYS.CH> |
| Subject: | Re: use data set |
| In-Reply-To: | <1182594461.004666.178630@p77g2000hsh.googlegroups.com> |
| Content-Type: | text/plain; charset="iso-8859-1" |
Hi, and welcome to SAS-L!
if you want numeric variables then you have to read (i.e. INPUT)
them accordingly. The $ sign in front of the column positions
instructs SAS to read those fields into character variables.
You want S,D,F as numeric variables, so make that
INPUT A $1-3 S 4-6 D 7-9 F 10-12;
Next you need to help us so that we can help you. What do you mean
by "only use data step please"? A single data step solution? A
solution involving two or more data steps? What prohibits the use
of procedures here?
Sounds like an exam question and many of us here on SAS-L have
made it a habit to reply in the spirit of the Chinese(?) proverb
"Give a man a fish and you feed him for a day. Teach a man to fish
and you feed him for a lifetime."
So take this little piece of advice and write back to SAS-L
showing what you attempted and where you failed.
BTW (by the way), did you know that most of SAS's documentation is
available for free via the internet?
Check http://support.sas.com/documentation/onlinedoc/
Kind regards
Robert Bardos
Ansys AG, Zurich, Switzerland
> -----Urspruengliche Nachricht-----
> mcgrathsas@GMAIL.COM
> Gesendet: Samstag, 23. Juni 2007 12:28
>
>
> DATA SSK;
> INFILE CARDS TRUNCOVER ;
> INPUT A $1-3 S $4-6 D $7-9 F $10-12;
> CARDS;
> QW 12 14 11
> ER 2
> GD 35 12
> ;
> RUN;
> I WANT TO CHANGE CHARECTER VARIABLE S,D,F TO NUMERIC VARIABLE
> AND SUM OF S,D,F
>
> onlu use data step please help me ..
>
> I.E I WANT OUTPUT LOOK LIKE IS
>
> A S D F
> 47 14 25
>
> AND TO FIND PERENATGE ALSO I.E
>
> S--VARAIBLE DEIVIDEDED BY 10 I.E 47/10*100
>
> D--VARAIBLE DEIVIDEDED BY 13 I.E 14/13*100
>
>
> F--VARAIBLE DEIVIDEDED BY 17 I.E 25/17*100
>
>
> FINALLY I WANT OUTPUT LIKE AS
>
> A S D F
> 47( %) 14(%) 25( %)-sum
> QW 12 14 11
> ER 2
> GD 35 12
>
>
>
> Thanku advance
>
>
|