Date: Mon, 24 Mar 2003 10:11:49 -0800
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: Maybe an easy question
Content-Type: text/plain; charset="iso-8859-1"
Unfortunately, that's way proc freq is designed to do for now.
A workaround is to turn the data from multiple variables and
few obs to few variables and more obs, i.e. 'frm' to track what
variable the number is from, and 'val' to store the real number
of that variable:
** test data with 3 varaibles;
data xx;
do term_mb=1 to 3;
do i=1 to 10;
vcsm=int(ranuni(0)*10);
vhip=int(ranuni(0)*10);
vrcr=int(ranuni(0)*10);
output;
end;
end;
** 'transpose' the data;
data xx (keep=term_mb frm val);
set xx;
array vall vcsm vhip vrcr;
do over vall;
frm=vname(vall);
val=vall;
output;
end;
proc sort;
by term_mb frm;
proc freq data=xx;
table val / out=yy;
by term_mb frm;
run;
proc print;
run;
-----------------------
Obs term_mb frm val COUNT PERCENT
38 2 vrcr 3 1 10
39 2 vrcr 5 1 10
40 2 vrcr 6 1 10
41 2 vrcr 7 1 10
42 2 vrcr 8 2 20
43 3 vcsm 2 3 30
44 3 vcsm 3 2 20
45 3 vcsm 4 2 20
46 3 vcsm 6 1 10
47 3 vcsm 9 2 20
48 3 vhip 0 1 10
....
HTH
Ya Huang
-----Original Message-----
From: GOMEZ TEJERINA, PEDRO ALBERTO [mailto:PEDRO.GOMEZ@GRUPOBBVA.COM]
Sent: Monday, March 24, 2003 8:40 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Maybe an easy question
--- Recibido de BBVACENT.U094016 GOMEZ TEJERINA, PEDRO AL* 24-03-03 17.40
-> SAS-L@LISTSERV.UGA.EDU
Dear SAS users,
I am trying to create an output data set from a proc freq. I am using
several variables, but the output data set just contains figures for the
last of the variables I am using in a list. How could I get that the output
data set had the figures for all the variables of the list?
This is the code I´m using:
%let listamb2= vcsm vhip vrcr vamp vfin ind_ul vpp ind_ac
vval vcla voro vnov vsev vseh vn_p vvst vamv vppl;
proc freq data=kk noprint;
tables &listamb2/out=nvagr1;
output out=nvagr1;
by ter_mb;
run;
Many thanks for your help.
Yours,
Pedro Gómez.
_\\|//_
\\\ ~ ~ ///
(' o o ')
---------oooO-(_)-Oooo---------
Pedro Alberto Gómez
Departamento de Investigación Comercial
BBVA
Goya 14
28001
Madrid.
913743577 <mailto:PEDRO.GOMEZ@GRUPOBBVA.com>
"Lo importante no es lo que se dice, sino lo que no hace falta decir"
Camus.
---------oooO------Oooo---------
( ) ( )
\ ( ) /
\_) (_/
************************************ DISCLAIMER *****************************************
This message is intended exclusively for the named person. It may contain
confidential, propietary or legally privileged information. No confidentiality or
privilege is waived or lost by any mistransmission. If you receive this message in
error, please immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender. Your must not, directly or indirectly, use,
disclose, distribute, print, or copy any part of this message if you are not the
intended recipient. Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is authorised
to state them to be the views of GrupoBBVA. Please note that internet e-mail neither
guarantees the confidentiality nor the proper receipt of the message sent. If the
addressee of this message does not consent to the use of internet e-mail, please
communicate it to us immediately.
****************************** AVISO LEGAL ***********************************************
Este mensaje es solamente para la persona a la que va dirigido. Puede contener
información confidencial o legalmente protegida. No hay renuncia a la
confidencialidad o privilegio por cualquier transmisión mala/errónea. Si usted
ha recibido este mensaje por error, le rogamos que borre de su sistema
inmediatamente el mensaje asi como todas sus copias, destruya todas las copias
del mismo de su disco duro y notifique al remitente. No debe, directa o
indirectamente, usar, revelar, distribuir, imprimir o copiar ninguna de las partes de
este mensaje si no es usted el destinatario. Cualquier opinión expresada en este
mensaje proviene del remitente, excepto cuando el mensaje establezca lo contrario
y el remitente esté autorizado para establecer que dichas opiniones provienen de
GrupoBBVA. Nótese que el correo electrónico via Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta recepción de los
mismos. En el caso de que el destinatario de este mensaje no consintiera la
utilización del correo electrónico via Internet, rogamos lo ponga en nuestro
conocimiento de manera inmediata.
***********************************************************************************************