problem about sas-Collection of common programming errors


  • oob
    sas
    Say I’ve already sorted set1 and set2 by the variables ‘sticks’, ‘stones’, and ‘bones’ and then i do this:data merged;merge set1(in=a) set2(in=b);by sticks stones bones;if a and b then output;*else we don’t want to do anything; run;Is there an easy way to drop all the variables from set2 in the merged dataset without having to type them all? I keep running into this problem where I have two datasets – both with quite a few variables – and I only want to merge them by a few variables and then on

  • user2146441
    sql sas
    I’m trying to get the mode of a certain list of variables. When the mode is not unique, I want to return the average of the mode so that a subquery to get the mode (in a larger query) doesn’t return two values. However, when the mode is unique, the average query returns a missing value for some reason. I have the following sample data:data have; input betprice; datalines; 1.051.051.056run;PROC PRINT; RUN;proc sql; select avg(betprice) from(select betprice, count(*) as count_betprice from have gr

  • frank
    sql merge sas
    hi guys i need to merge two tables in Sasbut with a condition like in a sql merge statement:MERGE INTO TABLE_NAME USING table_reference ON (condition) WHEN MATCHED THEN UPDATE SET column1 = value1 [, column2 = value2 …] WHEN NOT MATCHED THEN INSERT (column1 [, column2 …]) VALUES (value1 [, value2 …there is somthing like that?in case there isn’t can you tell me how can i make this kind of append with condition ?

  • Joe
    oracle sas
    I can connect to schema and tables through TOAD, but when I try to connect through a SAS libname statement I get:libname JOED oracle user=XXX orapw=XXXXX path=”XXXXX.World” schema=XXX;ERROR: ORACLE connection error: ORA-12154: TNS:could not resolve the connect identifierspecified. ERROR: Error in the LIBNAME statement.I have checked my TNSNAMES.ORA file and the server exists (like I said I can connect through TOAD)I have also confirmed the connection through Data Sources (ODBC) – x86Please help!

  • David Locke
    format sas sas-macro
    I’m revising a data step that resides in a SAS macro. Currently a single format is used to create a new field for the whole dataset. I’m attempting to revise it to where a different format will be used on different subsets of the dataset. (I have a field that indicates which subset the row belongs to.)I could do this with a bunch of if statements, but that would need to be changed if the number of categories changes in the future. I think I can achieve what I want by using call symput and re

  • Daniel Friis
    sql performance sas
    I have two tables. Table A contains daily information on transactions on corporate bonds from 2004 to 2012, and table B contains bond rating information on specific dates. I need to join the two tables, so that for each transaction i table A, the most recent rating for that specific bond is appended.Table A: daily_transactions ——————————————– DATE |BOND |PRICE ——————————————– 20110401 |AES |100 20110402 |AES |101 2

  • chucknelson
    sas
    Is there a way to check how many observations are in a SAS data set at runtime OR to detect when you’ve reached the last observation in a DATA step?I can’t seem to find anything on the web for this seemingly simple problem. Thanks!

  • BryanVoy
    hard-drive sas
    This is in regard to mass HDD wiping/testing. The software I use, WipeDrive Pro 5 and 7, both fall victim. I originally thought it was a limitation of the software, but after speaking with the software company, I was told there is no limit but what the machine is limited to. I go through a lot of hard drives and need to verify their integrity and that all data is removed. I have a few expansions hooked to various brands of servers, IBM, HP, Dell. They all limit me to exactly 26 simultaneously se

  • Rob Penridge
    sas
    I have a program I want to run in batch. When running it interactively the code occasionally crashes (still working on figuring out why) and when it does this a popup window shows with the typical memory exception messages. My question is – If I run the program in batch, will this popup still show? If it does it would prevent the execution of the next jobs until someone closes the window which I want to avoid.The crash is intermittent and I don’t want to break our nightly run by just making th

  • JDB
    sas enterprise-guide
    I am using Enterprise Guide 4.2 (no choice about this).I am using PROC APPEND to append about 80k+ observations to a SQL Server table. I believe that there are some issues with the format of the data (such as mismatching variable lengths), but it executes just fine and the table is updated. Then, Enterprise Guide gives me the following message:The contents of Log(af771r01 (Process Flow)) is too large to display. The window will close, but the contents will remain in the project.I was able to suc

  • longneck
    performance raid ssd sas
    i was planning to buy a SAS system made of two 15k RPM disks in Raid 0 configuration to give a boost to my s.o. and my apps… but after i saw that article on Coding Horror, i’ve started to thinking if a new 2nd generation SSD could do the same job, or even better…Does anybody have any information to help me decide?

  • Joe
    sas
    I recently inherited a SAS program that looks something like this:%MACRO ComplicatedStuff( GroupId= );%LET FileId = %SYSFUNC( OPEN( Work.BigDataSet ) );%PUT ‘Doing something really difficult with ‘ &GroupId.;%LET CloseRC = %SYSFUNC( CLOSE( &FileId. ) );%MEND ComplicatedStuff;%ComplicatedStuff(GroupId=ABC1); %ComplicatedStuff(GroupId=DEF2); %ComplicatedStuff(GroupId=3GHI); %ComplicatedStuff(GroupId=J4KI);Being a multi-faceted programmer, I looked at this and thought “surely I can make

  • johnv
    sas
    I have a dataset as follows and I need to retrieve two things: 1) the sum of VALUE between (date-1) and (date-3) for each date and 2) whether, during the 5 days, there are >= two days where the VALUE is 0. I think PROC SQL should be used but I’m not sure how to implement this. INPUT DATASET:ID DATE VALUE 1 20110101 0 1 20110102 0 1 20110103 1 1 20110104 2 2 20110101 1 2 20110102 2 2 20110103 3 2 20110104 4 Output should be 1) 1 (0+0+1) for

  • Andy Shinn
    raid sas lsi megaraid
    I am working with 2 x Supermicro SC837E26-RJBOD1 chassis connected to a single LSI 9285-8e card in a Supermicro 1U host. There are 28 drives in each chassis for a total of 56 drives in 28 RAID1 mirrors.The problem I am running in to is that there are duplicate slots for the 2 chassis (the slots list twice and only go from 0 to 27). All the drives also show the same enclosure ID (ID 36). However, MegaCLI -encinfo lists the 2 enclosures correctly (ID 36 and ID 65).My question is, why would this ha

  • CarolinaJay65
    sas
    Given a column below, I was trying to separate contact, address,zip, phone, fax & website address using sas 9.1column 1 : Company_addressContact:Sean Collins Address:6301 NW 5th Way Suite1700 FortLauderdale, FL 33309 Phone:(954) 689-3984 Fax:(954) 689-3985 http://www.aajtech.comoutput should be something like thiscolumn 2 : Contact – Sean Collins column 3 : address – 6301 NW 5th Way Suite1700 Fort Lauderdale, FL column 4 : zip – 33309 column 5 : phone – (954) 689-3984 column 6 :

Web site is in building