Thursday, May 11, 2017

SQL Server: Drop tables

SQL Server - Drop temporary table



IF OBJECT_ID('tempdb..#DispenseTrans') IS NOT NULL
  DROP TABLE #DispenseTrans
GO



SQL Server - Drop permanent table



IF OBJECT_ID('esdispense', 'U') IS NOT NULL
  DROP TABLE esdispense
GO



Wednesday, April 26, 2017

SAS: Crosscorrelations over time in PROC ARIMA

proc sort data=sashelp.pricedata out=test;
    by productname regionname;
run;


proc arima data=test ;
  by productname regionname;
  identify var=sale crosscorr=price;
  ods output AutoCorrGraph=correlations;
run;



Friday, March 17, 2017

SAS: put   in html



How to include an   in HTML written by SAS.

Declaration:

    * Source: http://marc.info/?l=sas-l&m=116624302014032&w=2 ;
    %let nbsp=%nrstr(&nbsp);


Use:

    put "Part Number: ";
    put "" PART_NUMBER "";
    put " (" PART_DESCRIPTION +(-1) ")";



("mark" tag creates yellow-highlighted text)

Result:



Friday, November 11, 2016

R: list vs. (c)ombine

list vs. (c)ombine

(Lists can hold different types of objects; keeps them distinct.)




> mylist = list(x=1:5, y=c("a", "b", "c"), z=c(T,F,T))
> mylist
$x
[1] 1 2 3 4 5

$y
[1] "a" "b" "c"

$z
[1]  TRUE FALSE  TRUE

> mycombine = c(x=1:5, y=c("a", "b", "c"), z=c(T,F,T))
> mycombine
     x1      x2      x3      x4      x5      y1 
    "1"     "2"     "3"     "4"     "5"     "a" 
     y2      y3      z1      z2      z3 
    "b"     "c"  "TRUE" "FALSE"  "TRUE" 


 
 

Wednesday, November 9, 2016

R: assign function

This will come in handy someday...


    x = "y"
    assign(x, c(3:6))



The result is a variable x with value "y", and a vector y with values int[1:4] 3 4 5 6




Wednesday, October 19, 2016

SAS - Assign LIBNAME to WORK



Assign libname to WORK...


    %let workLocation=%sysfunc(getoption(work));
    libname bill "&workLocation.";


Source: http://stackoverflow.com/questions/31051172/how-can-i-assign-libname-to-work-data-library-in-sas