Category: Allgemein

  • Calculate elapse period in Teradata

    A nice feature of a DBMS is to be able to calculate elapse period. Important questions like “how many days to go to pension?’, can be addressed. In teradata, this looks like: select cast(1231125 as date) – current_date; This little sentence involves a typecasting from an integer to a date. The integer is 1221125 that…

  • A pivot table in Teradata

    Teradata recently introduced the concept of pivoting in its sql. The idea is relatively straightforward. A column is selected that has some distinct values. Pivoting then implies that the distinct values are translated into columns. Doing so another value is used to derive the actual content in the columns. This can be a sum, maximum…

  • Using the SAS Viya environment

    Today, I played with the new SAS Viya environment. This environment has been promoted as a cloud based environment by SAS that acts as a SAAS solution to analytics needs from an organisation. This implies that we only need an internet connection and a browser to access this environment. How does it work. A small…

  • A graceful way to end a SAS job

    I found one possibility to gracefully end a SAS job. The code is rather straight forward. One opens a macro with a condition statement %if %then etc. If the condition is fulfilled, the code may run as previously anticipated. If not, a return statement ends processing the procedure. %let dsn=work.a; %macro abortIfRemaining; %if (%sysfunc(exist(&dsn))) %then…

  • Recursive queries in Teradata

    Similarly to Oracle connect by level (see also http://van-maanen.com/index.php/2016/04/08/an-oracle-programme-with-a-loop/ ), Teradata has a structure whereby tables can be connect in order to create a potentially large table. Let us show some code: with RECURSIVE jaren(belastingjaar) as ( select belastingjaar from (select 2015 as belastingjaar)A union all select belastingjaar+1 from jaren where belastingjaar < 2020 )…

  • Using SAS Webreporting

    SAS currently allows to create simple reports via a web portal. This works as follows. Assume, one has an environment where the correct installation is made. One may then invoke the web report studio via call from the browser. In my case. it is http://sasspeel:80/SASWebReportStudio. The advantages are clear. One may share the report across…

  • Teradata: information on table

    Teradata has a nice command to get a quick overview on tables. This command is as follows: help statistics table_name. In the output, I see indicators like the data and time of the creation, the number of unique rows etc. This command can be combined with another command like: select * from dbc.tables where databasename…

  • Deploy jobs in SAS

    One may use the SAS Management Console to deploy SAS jobs. The trick is as follows. One must have a SAS job that could be either created from the SAS programme or could be exported from Enterprise Guide. Let me provide an example of such a programme: This can be deployed, using in SAS Management…

  • Like any

    Today, I learned something that could be quite handy. Quite often I wanted the like condition on two conditions. I then created a SQL statement like: select * from XXX where field like ‘%ni%’ or field like ‘%NI%’. This can done in a less complicated formula. This looks like select * from XXX where field…

  • SAS, error but correct outcomes

    Recently I noticed that an error in SAS does not automatically lead to wroung outcomes. Look what happens. I created two tables that are sorted by a field (nummer). proc import datafile = ‘C:\Users\tomva\SynologyDrive\SAS\input.xlsx’dbms=xlsx out=input replace;run; proc means data=input sum noprint;by nummer;var aantal;output out=sumtot sum=;run; data sumtot(drop=_type_ _freq_); set sumtot(rename=(aantal=sum_aantal)); run; proc sort data=sumtot;by nummer;run;proc…