Category: SAS

Finding your Dream Car with a little macro magic

Suppose you want a list of car manufacturers from the CARS dataset. Easy!  Call the %CHARLIST macro from a %PUT statement, like this: The CHARLIST macro generates a list of unique values of a selected variable from a selected dataset. So does PROC FREQ. But, if you don’t need statistics, the CHARLIST […]

The post Finding your Dream Car with a little macro magic appeared first on SAS Learning Post.

Do you say coke, pop, or soda?

Quick Quiz! Where might you hear the following conversation? … Waitress: “What would you like to drink, honey?” Customer: “I’ll have a coke.” Waitress: “What kind?” Customer: “Diet Pepsi.” If you answered somewhere between Texas and Georgia, you woul…

Compatibility between model data and the target population

To make accurate predictions, it is necessary that the sample data you use for model development is compatible with the target population. The distribution of each input used in the model should be similar in the sample and the target population. In yo…

RDU airport -vs- surrounding parks and nature

In growing areas such as the Research Triangle Park, there is always the tough decision between developing land for business, or keeping it natural for parks and recreation. SAS is fortunate to have the great hiking trails at Umstead Park just across t…

Share your SAS Certification experience and maximize value

You know the value of your SAS Certification; does the rest of the world? A recent MONEY and Payscale.com study named SAS Analytics skills as the most valuable skills to have in today’s job market and certification is the best way to demonstrate those skills. Recognition like this helps solidify […]

The post Share your SAS Certification experience and maximize value appeared first on SAS Learning Post.

How to format a macro variable

Would you like to format your macro variables? Easy!  Just use the %FORMAT function, like this: What?! You never heard of the %FORMAT function? Of course not, cuz it doesn’t exist! No problem. Just create it, like this: %macro format(value,format); %if %datatyp(&value)=CHAR %then %sysfunc(putc(&value,&format)); %else %left(%qsysfunc(putn(&value,&format))); %mend format; The %FORMAT […]

The post How to format a macro variable appeared first on SAS Learning Post.

Cisco Information Server (CIS) and MS OLAP

Ok, so my recent issue was integrating CIS with Microsoft OLAP cubes. The normal way to do this is to set up MS OLAP (SSAS) with a website and use XML/A to connect. I started down that path and decided to try a different tack based some StackOverflow articles. Here is my approach that worked great:

The trick here is to use a Linked Server in the middle of the connection. For this, you need a SQL Server
instance.


Steps


Open SSMS. Create a new query


In a SQL Server instance, set up a Linked Server. Here is an example:

EXEC sp_dropserver ‘TEST_OLAP’
EXEC master.dbo.sp_addlinkedserver
@server=’TEST_OLAP’,
@srvproduct=’MSOLAP’,
@provider=’MSOLAP’,
@datasrc=’APSEPXXXX’,
@catalog=’Commitments’


EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname=’TEST_OLAP’,
@useself=’False’,
@locallogin=NULL,
@rmtuser=’MS\XXXXX’,
@rmtpassword=’***********’
GO

• Create a query to go against the Linked Server and pass the MDX query:
select
“[Policy].[Master Policy].[Master Policy].[MEMBER_CAPTION]” AS MasterPolicy,
“[Due Date].[Calendar].[Year].[MEMBER_CAPTION]” AS Year,
“[Due Date].[Calendar].[Quarter Name].[MEMBER_CAPTION]” AS Quarter,
“[Due Date].[Calendar].[Month Name].[MEMBER_CAPTION]” AS Month,
“[Policy].[Policy Number].[Policy Number].[MEMBER_CAPTION]” AS Policy,
“[Measures].[Commitments Closed Within TAT]” As CommitmentsClosedWithinTAT
from openquery
(
‘TEST_OLAP,
‘SELECT NON EMPTY { [Measures].[Commitments Closed Within TAT] } ON COLUMNS, NON EMPTY
{ ([Policy].[Master Policy].[Master Policy].ALLMEMBERS *
[Due Date].[Calendar].[Month Name].ALLMEMBERS *
[Policy].[Policy Number].[Policy Number].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION,
MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( { [Due Date].[Calendar].[Year].&[2015] } ) ON COLUMNS FROM [Commitments
Advocate4Me])’
)


• NOTE: If you need to determine the odd MDX variables coming back, run this query:
select * INTO #TEMP_A4M from openquery
(
‘TEST_OLAP,
‘SELECT NON EMPTY { [Measures].[Commitments Closed Within TAT] } ON COLUMNS, NON EMPTY
{ ([Policy].[Master Policy].[Master Policy].ALLMEMBERS *
[Due Date].[Calendar].[Month Name].ALLMEMBERS *
[Policy].[Policy Number].[Policy Number].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION,
MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( { [Due Date].[Calendar].[Year].&[2015] } ) ON COLUMNS FROM [Commitments
Advocate4Me])’
)


select * from tempdb.sys.columns where object_id =object_id(‘tempdb..##TEMP_A4M’);


  1. Set up your SQL Server Data Source

• Put it into Packaged Query and do Design by Exampl

PROC FORMAT Error with CNTLIN

What I was doing:Using a SQL Server table to feed a PROC FORMAT using CNTLIN.Error message seen:ERROR: Cannot mix missing and nonmissing values in the same rangeCause:START column was defined as character and END column was defined as a numeric (decimal)