f



Re: Data processing problem #2

On Mon, 8 Sep 2008 09:56:14 -0700, jn mao <jn_mao@YAHOO.COM> wrote:

>Hi SASLs,I have a large dataset. I need to calculate the duration by each
two connected dates bydrug for each patient, then divided by NT. Only
select the 2nd data of NT to divide duration.?My data:ID  date  drugname
NTaa  1/2/08   xx   10aa  2/1/08   xx   14aa  2/3/08   yy   11aa  3/1/08
xx   15aa  3/2/08  yy   16The data I want:ID  duration  drugname NT
NT_duraa   31     xx     14     14/31aa   28     xx     15     15/28aa
29     yy     16     16/29?The duration is the difference of two connented
dates for the same drug.like drug xx first data:  31=2/1/08-1/1/08.Thanks
much.Jane??

Your post came through rather badly jumbled.

Anyway, it looks like a straightforward matter of sorting then transforming.
Try:

   data have;
   informat ID drugname $2. date mmddyy8.;
     format                 date mmddyy8.;
   input
   ID  date     drugname  NT ; cards;
   aa  1/2/08   xx        10
   aa  2/1/08   xx        14
   aa  2/3/08   yy        11
   aa  3/1/08   xx        15
   aa  3/2/08   yy        16
   ;

   proc sort data=have out=sorted;
   by id drugname date;
   run;

   data want;
   set sorted;
   by id drugname;
   duration = dif(date);
   ratio = nt / duration;
   if not first.drugname;
   drop date;
   run;
0
hs
9/8/2008 6:48:47 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
560 Views

Similar Articles

[PageSpeed] 31

Reply:

Similar Artilces:

Re: sas data xport problem #2
from documentation The UPLOAD and DOWNLOAD procedures in SAS/CONNECT and PROC COPY with the XPORT engine are the only strategies available for regressing a data set to SAS 6. In order to transport SAS 9 and SAS 8 files back to SAS 6, set the portable VALIDVARNAME system option to the value V6 in the SAS session in which you are transporting the file. so use options validvarname=v7; Data class; set sashelp.class; accession_no=1; run; options validvarname=v6; libname out xport 'd:/temp/outdata.xpt'; proc copy in=work out=out;select class; run; HTH Andre Arthur Tabachneck a �crit :...

Re: SAS Data Integration Problem #2
Tata I had never heard of "Transformation Generator" until I saw your posting so this is a pure guess but were some files moved overnight so that the pointers in the user-written code can't find them? Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 tata Birla <tata2birla@GMAIL .COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion"...

Re: SAS 9.2 Update on problem re Help files #2
SNOTES is an approximately daily email from SAS STech Support listing the new or changed usage notes since the last email. So the item pertaining to you was: 32792 - SAS prompts you to rebuild the index when you press F1 to request help while running a SAS procedure in SAS 9.2 Release(s) Reported: 9.2 Release(s) Fixed: Date Created: 28JUL2008 Date Last Updated: 11AUG2008 http://support.sas.com/kb/32792.html To subscribe, go to http://support.sas.com/techsup/news/snotes.html You'll get an extra email on most workdays, but if you subscribe to SAS-L you'll hardly notice one more. There's also http://support.sas.com/techsup/news/tsnews.html It has news about tech support office hours and a few other things. If you want even more news, and you have an RSS reader, you can go to http://support.sas.com/community/rss/index.html On Mon, 25 Aug 2008 11:10:05 -0400 (GMT-04:00), "Peter Flom" <peterflomconsulting@mindspring.com> said: > Hi Jack > > I don't think I've ever looked at tech support notes ..... where is it? > Is it useful for browsing? > > Peter > > -----Original Message----- > >From: Jack Hamilton <jfh@alumni.stanford.org> > >Sent: Aug 25, 2008 11:08 AM > >To: Peter Flom <peterflomconsulting@mindspring.com>, "sas-l@listserv.uga.edu" <SAS-L@LISTSERV.UGA.EDU> > >Subject: Re: [SAS-L] SAS 9.2 Updat...

Re: SAS data step processing question #2
Hello I am not sure how to explain the way around try something like this data v2 ; Set V2(where = (type ^= 1)) ; By id Descending Date ; If First.Id and Nocase = 1 ; Run ; This way you are exluding everything in the set statements. And SAS does act differently when you use IF and where statements Hope you would get a better explanation from some body else On 12/12/08, D T <sasandstats@live.com> wrote: > > I used this code: > > data v2; > set v1; > by id descending date; > if type ne '1' then delete; > if first.id and nocase=1; > run; > > and was assuming it would process restriction 1 first (if type ne '1' then > delete;), and would then, after excluding all other types select the first > row (first.id) for those with nocase=1. > > I found out the hard way that SAS actually processed this differently: it > seemed to have selected those with type=1 among those for which the second > statement was true--so, in a way, SAS reversed the order of my statements. > > Can anyone explain? > > Thanks and best regards, > D. > _________________________________________________________________ > Send e-mail anywhere. No map, no compass. > > http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008 ...

Re: Data set problems and basic understanding of SAS #2
On Wed, 13 Jul 2005 19:37:55 -0400, Robert Slotpole <rslotpole@COMCAST.NET> wrote: >I keep working through the tutorials but there are so many of them. I know >this is a verry basic question but just the same any and all help greatly >appreciated. OK. But posting essentially the same question multiple times under different subject headings isn't really going to accomplish much. >In my main table D6 I have 200 observations consisting of 40 tickers >repeated for each of 5 dates. I issue a proc summary by date and get 5 >observations (1 for each date) that I now wa...

Re: SAS/ACCESS for Oracle: data type problem #2
matt, Is the oracle client compatible with you SAS 9 version ? Even if you chang something in SAS config by a hot fix, verify the version of your DBMS client, too. See the SAS support site for this. St�phane. Selon Matt_Pettis <Matthew.Pettis@GMAIL.COM>: > Hi, > > I've posted on this topic before > (http://groups.google.com/group/comp.soft-sys.sas/tree/browse_frm/thread/77dfbc8956ae56a1/d8ea0ade2a09415d?rnum=1&q=datatype+that+is+not+supported&_done=%2Fgroup%2Fcomp.soft-sys.sas%2Fbrowse_frm%2Fthread%2F77dfbc8956ae56a1%3Ftvc%3D1%26q%3Ddatatype+that+is+not+sup...

Re: Data set problems and basic understanding of SAS part 2
On Wed, 13 Jul 2005 22:17:24 -0400, Robert Slotpole <rslotpole@COMCAST.NET> wrote: >In following up on my previous post I can create and merge the data: > >the following output shows what I mean: > > total_ total_ total_ > Obs DATE TICKER endshare dol_div sales purchases > > 1 2002-12-31 *$$$ 0.0 0.0 9617604 - 9617604 > 2 2002-12-31 ABT 5700.0 0.0 9617604 - 9617604 > 3 2002-12-31 AMAT 0.0 0.0 ...

Re: OT: SAS, Sun Claim World Data Processing Record #2
I'll bet someone at SAS monitors eWeek, and I'll bet they threw a holy fit when they saw how bad eWeek screwed up this article. It's pretty bad when a press release that is supposed to benefit your company ends up boosting one of your major competitors. After reading the article in its initial form, I had no idea whether they were talking about SAP or SAS. s/KAM ----- Original Message ----- From: "Mike Rhoads" <RHOADSM1@WESTAT.com> To: <SAS-L@LISTSERV.UGA.EDU> Sent: Friday, May 19, 2006 7:13 AM Subject: RE: OT: SAS, Sun Claim World Data Processing Record ...

Re: Ranges in sas? (was RE: Re: data step vs Proc sql) #2
Ooooh--interesting--thanks! I'll play with that... ________________________________ From: SAS(r) Discussion on behalf of Rickards, Clinton (GE Consumer Finance) Sent: Thu 4/20/2006 2:41 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Ranges in sas? (was RE: Re: data step vs Proc sql) Exactly. the only trick is that the range values must be integers. clint -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Pardee, Roy Sent: Thursday, April 20, 2006 3:57 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Ranges in sas? (was RE: Re: data step vs Proc sql) ...

Re: Deleting SAS Data from a SAS DATASET #2
Chandra - this isn't my expertise area - I'm sure others may have better ideas but I'll make three comments. If your datasets have a large number of variables, in your datastep method a WHERE clause will be more efficient - the IF statement causes each record to be fully read before it can be selected for deletion. A WHERE clause would only read the single variable in the case of records that meet the criteria for deletion. Data prod.Master_date; set prod.master_date; where snap_dt ne "&end_dt"d; run; You probably would be better off changing your data model though - my first thought would to be to store your data as separate yearly or monthly files and then access them with a view of the past two years or 24 months. With each month or year you would delete the oldest file and change the view one time period forward. *set up the data; data time1 time2 time3 time4; do i = 1 to 100; do t = 1 to 4; if t=1 then output time1; if t=2 then output time2; if t=3 then output time3; if t=4 then output time4; end; end; run; *three successive example views; data filet1 / view=filet1; set time1 time2; run; data filet2 / view=filet2; set time2 time3; run; data filet3 / view=filet3; set time3 time4; run; One more thought - since the data are appended - if the file is not reordered and you have the record counts from each append - then you can use firsto...

Re: Problems with 9.2
Holger, So you get some success if you reduce the amount you're copying/pasting? I would guess that there is some format or some such in the data that you're copying/pasting that is causing the problem. As I haven't run into any issues with 9.2 reading large datasets, nor have I seen too many complaints on SAS-L, I would be surprised if one did exist. That's why I would focus on the copy/paste method you are using. Good luck. John Gerstle Scientific Information Specialist Centers for Disease Control and Prevention NCHHSTP\DHAP-SE\QSDMB\Data Management Team Phone: 404-639-3980 Fax: 404-639-8642 Email: yzg9 at cdc dot gov >>-----Original Message----- >>From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] >>On Behalf Of Holger Bargen >>Sent: Tuesday, February 10, 2009 11:33 AM >>To: SAS-L@LISTSERV.UGA.EDU; Gerstle, John (CDC/CCID/NCHHSTP) >>Cc: Holger Bargen >>Subject: Re: Problems with 9.2 - reading of data >> >>Dear John, >> >>Thank you for your response. >> >>Trying to copy the data into notepad and then transfer it to SAS did not >>lead to any success. The astonishing thing is that the data, which caused >>the problem, are read fine, if I reduce the volume of the entire dataset >>(e.g. reduce it to only one sampling data). This means that there is no >>problem with the formating of the data but the capability of SAS 9.2 to >>re...

Re: SAS time problem and formula problem #2
Please re-post your second question and present the formula in-line, as part of the message. SAS-L does not allow attachments. Also make it a separate posting, with its own subject. When a person has two or more unrelated questions, there is no reason to bundle them in one posting. It's not as if one has to pay for postage. Making a separate posting for each question, with appropriate subjects, makes it much easier to carry on and follow the discussions. On Mon, 3 Nov 2003 11:51:14 +0000, Vijay Reddi <Vijay.Reddi@SSL- INTERNATIONAL.COM> wrote: >Hi All, > >I have two probl...

Re: data management- Data format problem #2
Hi Jane, You mention having some numeric data, but due to the rest of your commentary, "numeric data" may be the human applied "use" of the digits displayed. i.e. it is not certain whether your data variable is of type numeric or character. so I make a few references for each case. IF, your data variable in question is a numeric variable and SAS is "displaying" the numeric variable as 1,234.5 then your numeric variable may have a format associated with that numeric variable such as comma7.1 To change the "display" to 1234.5 then you can merely change the applied format to something like 7.1 e.g. data numtest; myvar = 1234.5; format myvar comma7.1; put myvar=; run; data numchange; set numtest; format myvar 7.1; run; * -or- ; proc datasets nolist; modify numtest; format myvar 7.1; run; IF, your variable is of type character then you can convert the comma format to a noncomma format by converting from comma displayed string back to a number and then reconvert the actual number with a noncomma format. e.g. data chartest; myvar = '1,234.5'; put myvar=; run; data charchange; set chartest; myvar = put(input(myvar,comma7.1),7.1); run; Hope this is helpful. Mark Terjeson Senior Programmer Analyst Investment Management & Research Russell Investments Russell Investments Global Leaders in Multi-Manager Investing -----Original Message----- From: SAS(r) Discu...

Re: FTP problem in SAS v9.2 #2
The problem may be with Windows Firewall/McAfee/Other Antivirus programs blocking all but some programs from using FTP. > Our program run on z/OS, but the same problem occurs on windows. > There is no problem accessing the same ftp server from a native ftp client, and ping works as well. > > I have opened an issue with SAS. > > Gadi > > > ...

Re: search SAS data set from SAS code #2
Rose, The answer to your question depends on your operating system. In Windows, there's the Search tool. In Unix/Linux, you can use grep Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com Rose <myr_rose@YAHOO.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 04/19/2005 11:13 AM Please respond to myr_rose To: SAS-L@LISTSERV.UGA.EDU cc: Subject: search SAS data set from SAS code Hi All, Suppose I have a sas permanent data set which was created early, I know the library path but I couldn't remember in which s...

Re: XML data to SAS data set converstion #2
A correction. The initial post asked: "Is it possible to convert an XML data to SAS data set without a SAS environment?" If there is no SAS at all in a particular shop, then there is no way to do this conversion. If access to SAS is available via IOM then there are ways. What "environment" means becomes the question. If a shop can simply convert into a compatible SAS XML format that is a possibility. The other is to convert it into a delimited file or get it into a database that a SAS shop can read. The SAS dataset layout is binary and unknown. You could put it into a S...

Re: Newbie SAS Array problem (take 2) #2
Hi Machelle, Nice, good. But you should also declare your arrays dxnum and diagnum as being of character type. And I would even completely avoid this kind of solution. I would use a format instead (with some arrays or some macro code). Create a format for your 46 diagnose codes, like: PROC FORMAT; VALUE $DiagFmt '4270' = 'Paroxysmal supraventricular tachycardia' .............and so on............. ; RUN; And if it is just for presentation then never create a variable with the textual diagnoses, but use the code variables (dx#) instead with the format. If you really n...

Re: Complex DATA step problem with longitudinal data #2
Thanks Ian! Now I have an elegant solution, as well as my ugly one (which used many many data steps) This will be very useful to me (and maybe to others) not just for *this* problem but for others. Peter -----Original Message----- >From: iw1junk@comcast.net >Sent: Jun 18, 2008 2:35 PM >To: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> >Cc: Peter Flom <peterflomconsulting@MINDSPRING.COM> >Subject: Re: Complex DATA step problem with longitudinal data > >Summary: An example of finite state machine thinking. > All programmers should be able to think this way. >#iw-value=1 > >Peter, > >You have a list of conditions: > >> If GDS stays the same, the interval has to be at least 5 years. >> If GDS changes the interval has to be at most 7 years. >> If GDS gets higher, and then lower, don't include the one that was >higher > >You have to make sure you have available at FIRST.FULLNAME the >information to make a decision on whether you want that group. >Since your condition are properties of the whole group you need a >preparatory step. Here is a model to work from. > > data q ; > length fullname $ 8 ; > input FullName $char8. Date :mmddyy10. GDS ; > cards ; > ADOLPH A 06/25/1980 2 > ADOLPH A 10/22/1980 2 > ADOLPH B 10/17/1984 2 > ADOLPH B 07/16/1981 2 > ADOLPH B 01/16/1985 2 > AILEEN A 08/11/1982 2 > ...

Re: Compressing data sets (was Re: [SAS-L]) #2
OK, "you or a program on your behalf will have to decompress them before use". -- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA >>> "Richard Graham" <richardwgraham@earthlink.net> 01/05/2004 5:04 PM >>> Actually you can compress(WINZIP, PKZIP) SAS data sets and use them in the compressed format. There is software named ZipMagic which allows zip files to be used as windows folders. I have done this with mixed results when the underlying data set is upwards of 4GB. Bu...

Re: problem when installing SAS. windows x64 does not support SAS? #2
Elodie, Take a look at: http://support.sas.com/kb/16/568.html HTH, Art --------- On Wed, 14 May 2008 07:54:57 -0700, elodie.gillain@GMAIL.COM wrote: >Hi everyone > >I am trying to install SAS on a Vista machine. > >The setup wizard says that Windows x64 does not support the SAS >version I am trying to install. > >What can I do? > >I greatly appreciate your help. ...

Re: Compressing data sets (was Re: [SAS-L]) #2 #7
I'm crazy..yes, SAS/Access...not Connect... ________________________________ Bruce A. Johnson bjohnson@solucient.com -----Original Message----- From: Jack Hamilton [mailto:JackHamilton@firsthealth.com] Sent: Tuesday, January 06, 2004 1:22 PM To: SAS-L@LISTSERV.UGA.EDU; Bruce Johnson Subject: Re: [SAS-L] Compressing data sets (was Re: [SAS-L]) A new way to read/write Excel files in 9.1 was mentioned at SUGI, but as I recall it required a server running SAS/Access to PC File Formats. It wasn't SAS/Connect doing the reading and writing, just as SAS/Connect isn't doing the remote...

Re: SAS 9.2 Update on problem re Help files
On Mon, 25 Aug 2008 09:25:35 -0400, "Peter Flom" <peterflomconsulting@MINDSPRING.COM> said: > Hi again > > A week ago, I asked this list about a problem with 9.2: When you click > "help" it runs an index, but it doesn't save the index when you quite > SAS, so, each time you quit SAS, you lose the index. > > Replies received here did not work, so I wrote to SAS. > > They said, essentially, that it's a known bug, and they are working on > it. So you're responsible for the item in today's Tech Support Notes. Congratulations! That's almost as good as having a disease that gets you mentioned in the MMWR. > > Peter > > Peter L. Flom, PhD > Statistical Consultant > www DOT peterflom DOT com -- Jack Hamilton Sacramento, California jfh@alumni.stanford.org <== Use this, not jfh@stanfordalumni.org ...

Re: Compressing data sets (was Re: [SAS-L]) #2 #6
A new way to read/write Excel files in 9.1 was mentioned at SUGI, but as I recall it required a server running SAS/Access to PC File Formats. It wasn't SAS/Connect doing the reading and writing, just as SAS/Connect isn't doing the remote reading and writing in a regular Connect session. Or are you thinking of something else? -- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA >>> "Bruce Johnson" <bjohnson@SOLUCIENT.COM> 01/06/2004 10:02 AM >>> "using SAS/Connect to...

Re: Compressing data sets (was Re: [SAS-L]) #2 #4
It's not a big deal, but there is a difference between reading a file directly and having another program as an intermediary, and someone someday is going to get into trouble because they didn't take that into account. I'm not sure what you mean by "using SAS/Connect to read non-SAS files". -- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA >>> "Bruce Johnson" <bjohnson@SOLUCIENT.COM> 01/06/2004 9:36 AM >>> But if another program is doing it, within SAS, wh...

Web resources about - Re: Data processing problem #2 - comp.soft-sys.sas

Analog signal processing - Wikipedia, the free encyclopedia
Analog signal processing is any signal processing conducted on analog signals by analog means. "Analog" indicates something that is mathematically ...

Conexant Announces New Audio Processing Solutions At CES
At CES, Conexant gave me a demo of some of the audio processing technology that they've been working on. Conexant is a company that probably ...

THE PAYMENTS ECOSYSTEM: Everything you need to know about the next era of payment processing
The way we pay has changed dramatically. People are using their smartphones for every kind of formal and informal transaction — to shop at stores, ...

Audi turns to Qualcomm power for entertainment, navigation processing
Qualcomm proves its chip-making innovation, announcing a deal at CES where Audi will use its first automotive quality infotainment chipset, the ...

USDA Investigating Possible Plastic Sabotage At Poultry Processing Plant
While it’s not uncommon to hear about chicken products that end up containing wayward bits of plastic (like this nugget issue , this sausage ...

EXCLUSIVE: Feds Outsource Vet Benefit Processing To Philippines
Cheaper Philippine workers draw kudos for high-quality work at lower cost

This just in: Marco Rubio's substance is thinner than an Intel processing chip
In case you hadn't already guessed it, Marco Rubio's got a smile and a stump speech, but that's about it. Reporters who have followed him from ...

Food Processing: It's What Makes Us Human
Turning raw ingredients into something more has played an important role in our evolution.

Nvidia Ramps Up Processing Power for Self-Driving Cars
With its new Drive PX 2 platform, the GPU maker is offering a computer that can deliver up to 8 teraflops of computing power to autonomous vehicles. ...

Keeping Up With the Millennials in Spousal Immigration Processing
“Selfie stick. Snap. Upload to Facebook. 52 likes in a matter of minutes. These likes include people from all over the world who simply have ...

Resources last updated: 3/16/2016 8:09:14 PM