The code below lets you qoute the contant of a macrovariables e.g. to be used in an IN SQL-statement.
%let Variables = age height weight;
%let InStatement = %Str(%’)%sysfunc(Tranwrd(&Variables.,%Str( ),%Str(%’, %’)))%Str(%’);
The macrovariable InStatement will contain ‘age’,’height’,’weight’. And can then be used in an IN SQL-statement.
The code below will get the programname of the program being used.
%let SASProgramName = %GetSASProgramName;
This will only work on Windows.
When you try to connect to a provider with a certificate, you can get the message below e.g. in your Windows Event Viewer under Application.
The issuer of the Security Token was not recognized by the IssuerNameRegistry. To accept Security Tokens from this issuer, configure the IssuerNameRegistry to return a valid name for this issuer.
If you are using the thumbprint of the certificate in the web.config everything might seem to be correct. But the problem can be that you copied the thumbprint from the certificate. When you copy the thumbprint from the certificate you get an extra “invisible” stop-character (shown with yellow below) included in the copy and the pasting to the web.config. Don’t copy the thumbprint from the certificate. Just type it in manually.
Below is a couple of commands that can be used to get information about your SAS-installation.
The Setinit-command will give you information about the SAS-products that your SAS-installation is licensed for.
The Product_status-command will give you information about the SAS-products installed on your system.
Keep in mind that there could be a difference between what’s licensed on your system and what’s actually installed.
The commands above will only give you information about the products installed for base-SAS. If you want information about what other SAS-products is installed on you system, then you can get this SAS-program from SAS and run it on your system.
The command below will let you see a specific users AD-group belongings on the domain where the command is being executed.
The command below will let you run a program as another user on another domain.
runas /netonly /user:<domain>\<user> "<program>"
If you want to run SQL Server Management Studio 2014 you would use the command below.
runas /netonly /user:<domain>\<user> "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe"
The code below makes a folder with an ISOdate.
%let ISOdt = %sysfunc(datetime(), B8601DT.);
rc = system("mkdir c:\test\&ISOdt.");
The code below will add a trigger to all the tables in a specific schema on the Microsoft
-- Uses the build-in stored procdure in Microsoft SQL-server to run through all tables.
-- Initial command for the DB to use.
@precommand = 'use <db>',
-- Check if trigger already exists on table. If it does drop/delete it.
IF OBJECT_ID(''[user].[?_trig]'', ''TR'') IS NOT NULL
DROP TRIGGER [user].[?_trig]
-- Create trigger on all tables in a specific schema.
@command2 = '
CREATE TRIGGER [?_trig]
SET NOCOUNT ON
INSERT [<schema>].[<table>] ([<column1>], [table_name], [dtNow])
SELECT <columnname>, ''?'', CURRENT_TIMESTAMP FROM ?
-- Only look at tables in a specific schema.
@whereand = 'and upper(schema_name(schema_id)) = ''<SCHEMA>'''
A nice description of how to deliver data in the CSV-file format can be found here.
The command below will give you the AD-groups for a given user.