LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 9 Jan 2006 10:00:09 +0100
Reply-To:   Alte@uni-greifswald.de
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dietrich Alte <Alte@UNI-GREIFSWALD.DE>
Organization:   IES, EMAU HGW
Subject:   Re: Newbie SAS Array question
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1136672671.001012.179570@g43g2000cwa.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

You shoud, not keep your array fear, as ist is not too complicated, but, sorry - this does not look as a good example for an array. I would rather go one of these two ways:

1) Make a format for your diagnoses (diagname1..diagnameN) with PROC FORMAT and then apply this format to your variables. If your really need a char-variable with your format you can get it with the vvalue function for each dxN: diagnameN = vvalue(dxN)

(indeed: here you could use an array for the 25 dxN).

2) Put the diagnames into a dataset together with the codes and then combine data and codes with a merge by statement or with SQL.

HTH

Dietrich

machellewilchesky@gmail.com schrieb: > Hi > I have been avoiding using Arrays for years and today is the day where > I have put my foot down and have tried to face my fears and learn how > to use them for once and for all. > > I have a clinical dataset with 25 diagnosis codes (A primary diagnosis > and 24 potential secondary diagnosis variables). For each of these 25 > diagnosis codes I want to be able to define a new variable called > Diagname which corresponds to one of 46 possibilities. > > In a non-array world, my program would look something like this: > > data one; > set x; > if dx1 ='4270' then diagname1='Paroxysmal supraventricular > tachycardia' > if dx2 ='4270' then diagname2='Paroxysmal supraventricular > tachycardia' > .. > .. > .. > if dx25 ='4270' then diagname25='Paroxysmal supraventricular > tachycardia' > > if dx1 ='4274' then diagname1='Ventricular Fibrillation and flutter' > if dx2 ='4274' then diagname2='Ventricular Fibrillation and flutter' > .. > .. > .. > if dx25 ='4274' then diagname25='Ventricular Fibrillation and flutter' > > etc... > > Since I have 25 diagnoses *46 diagnosis codes, the full program would > require 1,150 lines of code, and so this seems like a likely candidate > for array processing. I have tried several ways to make it work but > I'm obviously missing something... An example of code I have tried is > this: > > data one; > set x; > attrib diagname1-diagname25 format=$70.; > > Array dxnum{25} dx1-dx25; > > Array diagnum(25) diag1-diag25; > > Array ICD{46}$ ('4270' '4271' '4272' '4273' '4274' '4275' '4276' > '4278' '4279' 'I471' 'I472' 'I479' 'I480' 'I481' > 'I490' 'I460' 'I469' 'I491' 'I492' 'I493' 'I494' > 'I470' 'I471' 'I495' 'I498' 'I499' 'R000' 'R001' 'R008' > > 'R012' 'I499' 'I518' '4289' 'I509' '4299' '4260' 'I442' > > '7853' '4298' 'I231' 'I232' 'I233' 'I2380' 'I2381' > 'I2382' 'I2388'); > > Array Diagname{46} $ ('Paroxysmal supraventricular tachycardia' > 'Paroxysmal ventricular tachycardia' > 'Paroxysmal tachycardia, unspecified' > 'Atrial Fibrillation and flutter' > 'Ventricular Fibrillation and flutter' > 'Cardiac Arrest' > 'Premature beats' > 'Other specified cardiac dysrhythmias' > 'Cardiac dysrhythmia, unspecified' > 'Supraventricular tachycardia' > 'Ventricular tachycardia' > 'Paroxysmal tachycardia, unspecified' > 'Atrial fibrillation and flutter' > 'Ventricular fibrillation and flutter' > 'Cardiac arrest' > 'Cardiac arrest with successful resuscitation' > 'Cardiac arrest, unspecified' > 'Atrial premature depolarization' > 'Junctional premature depolarization' > 'Ventricular premature depolarization' > 'Other and unspecified premature depolarization' > 'Re-entry ventricular arrhythmia' > 'Supraventricular tachycardia' > 'Sick sinus syndrome' > 'Other specified cardiac arrhythmias' > 'Cardiac arrhythmia, unspecified' > 'Tachycardia, unspecified' > 'Bradycardia, unspecified' > 'Other and unspecified abnormalities of heart beat' > 'Other cardiac sounds' > 'Cardiac arrhythmia, unspecified' > 'Other ill-defined heart diseases' > 'Heart failure, unspecified' > 'Heart failure unspecified' > 'Heart disease, unspecified' > 'Atrioventricular block, complete' > 'Atrioventricular block complete' > 'Other abnormal heart sounds' > 'Other ill-defined heart diseases' > 'Atrial septal defect as current complication following Acute MI' > 'Ventricular septal defect as current complication following Acute MI' > 'Rupture of cardiac wall without haemopericardium as following Acute > MI' > 'Papillary muscle dysfunction following acute MI' > 'Pericarditis following acute myocardial infarction' > 'Postmyocardial infarction angina' > 'Other complications following acute MI'); > > do j=1 to 25; > do k=1 to 46; > > if dxnum{j}= icd{k} then diagnum{j}=diagname{k}; > end; > end; > run; > > > Any and all points in the right direction would be appreciated! > > Thanks in advance, > > Machelle >

-- ---------------------------------------------------------------- DIETRICH ALTE, Dipl.-Statistiker, Dr. rer. med. Institut für Epidemiologie & Sozialmedizin --> Studien-Management "Study of Health in Pomerania (SHIP)" EMA-Universität Greifswald - Medizinische Fakultät Walther-Rathenau-Str. 48, D-17487 Greifswald, Germany URL www.medizin.uni-greifswald.de/epidem/ Phone ++49(0)3834-867713, Fax ++49(0)3834-866684 ----------------------------------------------------------------


Back to: Top of message | Previous page | Main SAS-L page