Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: dblan
  • Order by date
  1. dblan

    Sending an email using a SAS data step not executing

    I had a situation about 2 years where I needed SAS to auto email without needing to click the Send button. The way I got it done was by having SAS write a vbs file and then have SAS execute the vbs file. /*** Create vbs code ***/ data _null_; file "c:\temp\AutoEmail.vbs"; put 'Set fso =...
  2. dblan

    How to import pivot table report data into PC SAS

    Are you trying to import the source data for the pivot table or the pivot table? You should be able to import the source data with a proc import. [code] PROC IMPORT OUT= WORK.yourdata DATAFILE= "C:\yourfile.xls" DBMS=EXCEL REPLACE; SHEET="sheetname$"; GETNAMES=YES; MIXED=NO...
  3. dblan

    How to convert numeric data to hour:minute

    I'm not a time expert, but here is my best effort. /*sample dataset*/ data unformatted; input time code $3.; datalines; 1300 ert 1412 brt 1435 grt ; run; data formatted; set unformatted; newtime = put(time,$4.); format realtime hhmm5.; realtime =...
  4. dblan

    Formatting Excel Columns

    That field is formatted as a character in the SAS dataset, correct? (i.e. - $20 or something similar) I don't use ODS very much so I don't know if that is what is causing that, but I have used proc export and the Excel libname engine with good success to export long numbers that have been...
  5. dblan

    Creating time 'bucket' variable

    After thinking about it for another minute, since you data is probably in a column format, something like this can work. (Also, I adjusted the formula a little bit. Took out the "-60" to get the periods to count like you wanted them to). data yourdata; input Time time.; format Time time...
  6. dblan

    Creating time 'bucket' variable

    kangaroo2, Try using an equation like this. data test; format x y z time.; x = '08:00:00't; y = '08:01:00't; z = '08:02:00't; period1 = (x-(x-60))/60; period2 = (y-(x-60))/60; period3 = (z-(x-60))/60; run; dblan
  7. dblan

    Sum of rows

    I'd use proc sql for this and sum X. proc sql; create table newtable as select ID, sum(X) as SumofX from yourtable group by ID; quit; Dave
  8. dblan

    deleting part of the string

    Here is my solution, hope this helps. /* create test dataset */ data have; input FileName_ID $80.; datalines; August_ES_AMBP_Default_LeftNews_1_UK_Visa (278414) September_ES_AMBP_Default_LeftNews_1_UK_Visa (278415) October_ES_AMBP_Default_LeftNews_1_UK_Visa (278416)...
  9. dblan

    PROC SQL Pass through MS ACCESS

    Just a quick guess, but it looks like your table "E_Q Data CNTS" in Access has spaces in the name. SAS probably reads that as 3 different tables. Maybe try "E_Q_Data_CNTS" as the table in the SAS code, or as a test rename the table in Access to something without spaces to see if you still get...
  10. dblan

    Proc sql with macro variable help

    You have to use double quotes(") instead of of single quotes(') when you have a variable that needs a quotes around it. %LET Var = D; PROC SQL; SELECT title, rating, category FROM movies WHERE category LIKE "&var.%"; QUIT; Hope this helps. Dave
  11. dblan

    How to build a cumilitive loop

    Here ya go: data qtr; Year = year('01Jan93'd); devqtr = 0; do while (devqtr < intck('quarter','01Jan93'd,today())); devqtr+1; output; end; run; -Dave
  12. dblan

    data row arrangment

    prakash, Do you need different sort orders for the different groups? In your first example, Group 1's values are 8,2,then 4. Then Group 2's values are sorted 2,8, then 4. Here a way to sort just based on the Value column: You can create a column to sort with, then drop it once the data is...
  13. dblan

    data row arrangment

    Prakash, I don't understand how you want the dataset reformatted, but you can use the sort procedure to resort your data. proc sort data=yourdataset; by group value; run; By default it sorts ascending, but you can change that by putting "descending" in front of the variable you want to sort...
  14. dblan

    help shape data

    The part that makes more difficult is the need to have zero's when there isn't a match. For example, the number of CT's in 0. A count for that wouldn't show up in the Proc Freq because that combination isn't in the dataset. Below is one possible way to get the data reshaped like you are...
  15. dblan

    MONNAME changes results

    I've added a field to try to demonstrate why you are seeing this. First, let me explain how SAS handles dates. SAS holds dates as numeric values starting at 0 and adding 1 for each following day. Additional, the counting starts with Jan 01 1960. So to SAS Jan 1, 1960 = 0 Jan 2, 1960 = 1...
  16. dblan

    Problem selecting a sample - might need lag function

    Are you just trying to get a random sample? You can use Proc Surveryselect for that. proc surveyselect data=Full_List method=srs n=50 out=Sample_List; run; Method srs = Simple random selection N = number of samples you want If you want samples that equal a certain percentage of your data you...
  17. dblan

    Data input problem

    This should work. data have; input x y z count ; datalines; 1 0 1 2 1 1 0 1 0 1 1 2 ; run; Data want; set have; do i=1 to count; output; end; run; You can add (drop=count i) right behind Want to remove those 2 variables.
  18. dblan

    Get Windows User ID

    Here is something I use in a lot of my code. %let UserID=%sysget(USERNAME); To check to see if it returns what you want, you can run: %put User is &UserID; Hopefully this is what you need. Dave
  19. dblan

    Shutdown PC using SAS

    I think you would have to use SAS to execute a .vbs file to shutdown the PC. Here is a quick attempt to show how it could be done: data _null_; file "c:\temp\Shutdown.vbs"; put 'Sub ShutDown'; put 'nLogOff=0'; put 'nReboot=2' ; put 'nForceLogOff=4'; put 'nForceReboot=6'; put 'nPowerDown=8'...
  20. dblan

    'IF' and 'SET' statements

    Are the values in graf6 literally "<=1 and ">=2", or are you trying to say if the value in graf6 is less than or equal to 1 (or greater than/equal to 2)? If they are literally "<=1 and ">=2", then your code looks ok. For example, using your code plus a small sample dataset, the following runs...

Part and Inventory Search

Back
Top