12-18-2023
CarlosSpranger
Obsidian | Level 7
Member since
02-12-2019
- 27 Posts
- 10 Likes Given
- 2 Solutions
- 6 Likes Received
-
Latest posts by CarlosSpranger
Subject Views Posted 1294 09-14-2020 08:53 PM 998 06-12-2020 10:47 AM 1200 05-17-2020 10:49 PM 6272 05-17-2020 10:43 PM 1235 05-17-2020 08:14 PM 1240 05-15-2020 08:34 AM 1262 04-27-2020 07:00 PM 5625 04-27-2020 05:16 PM 1327 04-21-2020 10:17 AM 9424 03-24-2020 05:24 AM -
Activity Feed for CarlosSpranger
- Posted Re: SVN configuration with SAS Di for version control on Administration and Deployment. 09-14-2020 08:53 PM
- Liked Re: Concatenate values for Kurt_Bremser. 06-12-2020 10:51 AM
- Posted Re: Concatenate values on SAS Programming. 06-12-2020 10:47 AM
- Liked Re: Counting frequency by group and year for jgreenberg321. 05-18-2020 06:38 PM
- Posted Re: Getting the difference in datastep on SAS Programming. 05-17-2020 10:49 PM
- Posted Re: Counting frequency by group and year on SAS Programming. 05-17-2020 10:43 PM
- Posted Re: Getting the difference in datastep on SAS Programming. 05-17-2020 08:14 PM
- Posted Re: Help! How to create new variables and link them in two data sets. Back Testing Investment Strate on SAS Programming. 05-15-2020 08:34 AM
- Posted Re: Help! How to create new variables and link them in two data sets. Back Testing Investment Strate on SAS Programming. 04-27-2020 07:00 PM
- Posted Re: Simulate timeseries data with a SAS DATA Step and SAS Functions on SAS Communities Library. 04-27-2020 05:16 PM
- Liked Simulate timeseries data with a SAS DATA Step and SAS Functions for gsvolba. 04-27-2020 05:16 PM
- Got a Like for Re: Help! How to create new variables and link them in two data sets. Back Testing Investment Strate. 04-23-2020 10:51 AM
- Posted Re: Help! How to create new variables and link them in two data sets. Back Testing Investment Strate on SAS Programming. 04-21-2020 10:17 AM
- Posted Re: Library Datasets Summary Macro %DATA_SPECS on SAS Communities Library. 03-24-2020 05:24 AM
- Liked Library Datasets Summary Macro %DATA_SPECS for JeffMeyers. 03-24-2020 05:21 AM
- Liked Re: Simple Error Handling and Logging Strategy using SAS Studio for tomrvincent. 02-26-2020 02:02 PM
- Liked Re: Dealing with length when manipulating tables for jklaverstijn. 02-19-2020 11:23 AM
- Posted Re: Restore a lost VA report on SAS Visual Analytics. 02-17-2020 05:01 PM
- Posted Simple Error Handling and Logging Strategy using SAS Studio on SAS Communities Library. 02-17-2020 09:48 AM
- Liked Re: Building Models with SAS Risk Model Editor for cwid05. 02-14-2020 06:25 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 2 13 2 -
My Liked Posts
Subject Likes Posted 1 04-21-2020 10:17 AM 2 03-21-2019 06:16 AM 1 03-21-2019 06:22 AM 1 03-15-2019 07:00 AM 1 03-21-2019 06:12 AM -
My Library Contributions
Subject Likes Author Latest Post 2
09-14-2020
08:53 PM
Hello @rara please find below the important steps to achieve it:
Step 1: Tortoise SVN configuration on Client machines
Important: Ensure that Tortoise SVN has the command line tools for installation component installed.
tortoise command line tools
Step 2: Create a folder named archive on the following location on your machine:
C:\Program Files\SASHome\SASVersionedJarRepository\eclipse\plugins
Step 3: Then move the following folders inside the one created on step 2:
sas.dbuilder.versioncontrol.cvsplugin.nls_904600.0.0.20181017190000_v940m6
sas.dbuilder.versioncontrol.cvsplugin_904600.0.0.20181017190000_v940m6
sas.dbuilder.versioncontrol.git.nls_904600.2.0.20181031190000_v940m6
sas.dbuilder.versioncontrol.git_904600.0.0.20181017190000_v940m6
Step 4: Next, configure the connection parameters to the SVN Server in SAS Data Integration Studio (DIS) and test the connection.
SVN Pluging settings
Note: If you get an error, see the log on your machine at: C: \ Users \ youruser \ AppData \ Roaming \ SAS \ SASDataIntegrationStudio \ 4.904
And that's it. 🙂
I recommend configuring the “Builtin” feature of checking-in / checking-out objects in SAS DI Studio for a full nice expercience on the flow of versioning.
... View more
06-12-2020
10:47 AM
Hello @Lokesh4,
Whatever your need is, here you have it:
data test;
input Company $ ID Designation $;
Datalines;
ABC 1 Employee
ABC 1 Supervisor
ABC 2 Manager
run;
Data want;
set test;
new_var= CATX('-',ID,Designation);
run; /*The result below*/
... View more
05-17-2020
10:49 PM
Can you share a sample input related to this last output?
I Think the issue resides in your input data.
I recreated the scenario using proc sql and it works.
data have;
input acct_nbr tot_accts_cnt_trn no_act_cnt_ no_acct_ind;
Datalines;
run;
proc sql;
insert into have values (43,1,1,.);
quit;
data test(keep=acct_nbr tot_accts_cnt_trn no_act_cnt_ no_acct_ind);
set have;
no_acct_ind=tot_accts_cnt_trn-no_act_cnt_;
run;
acct_nbr=54 tot_accts_cnt_trn=159 no_act_cnt_=17 no_acct_ind=142 => 1st Iteraction
acct_nbr=54 tot_accts_cnt_trn=159 no_act_cnt_=17 no_acct_ind=142 => 2nd Iteraction
acct_nbr=54 tot_accts_cnt_trn=159 no_act_cnt_=17 no_acct_ind=142 => 3rd Iteraction
acct_nbr=43 tot_accts_cnt_trn=1 no_act_cnt_=. no_acct_ind=. => 4th Iteraction
acct_nbr=43 tot_accts_cnt_trn=1 no_act_cnt_=. no_acct_ind=. => 5th Iteraction
acct_nbr=43 tot_accts_cnt_trn=1 no_act_cnt_=. no_acct_ind=. => 6th Iteraction
acct_nbr=43 tot_accts_cnt_trn=1 no_act_cnt_=1 no_acct_ind=0 => 7th Iteraction
On the one with . which indicate missing values is expected because the subtraction expression should return missing values
I guest you should do some dta cleansing on input Data.
Regards
CS
... View more
05-17-2020
10:43 PM
Hello @jgreenberg321 ,
I was playing with your challenge and I have the following idea in attach
sas_snippet_cs_to_jgreenberg321.sas
Regards,
CS
... View more
05-17-2020
08:14 PM
Hello @Q1983,
I was playing with your challenge, and its quite difficult to figure out your need as you describe on the text. But I managed to add a new line with a Zero on Sales Variable to check and the behavior is as expected; The Diff calculates properly.
data have; input loan_num sales returns; datalines; 112 12 0 112 0 12 /*New Line with Value=Zero on Sales Variable*/ 113 11 10 114 9 5; run;
And When I Check the Execution iteractions all seem well:
loan_num=112 sales=12 returns=0 diff=12 => 1st Iteraction is correct
loan_num=112 sales=0 returns=12 diff= -12 => 2nd Iteraction is correct
loan_num=113 sales=11 returns=10 diff=1 => 3rd Iteraction is correct
loan_num=114 sales=9 returns=5 diff=4 => 4th Iteraction is also correct
Can you please elaborate?
regards,
CS
... View more
05-15-2020
08:34 AM
Hello @jkoleti ,
This time, I read the details on your description text, and I came with the idea of getting the elapsed time between the date and months after Date.
From here I think you carry on the with the rest of the validations
Regards
... View more
04-27-2020
07:00 PM
Hello @jkoleti ,
I was playng around your challenge, and I think I need more inputs. But till there , I share a small draft that its possible that you can improve your idea from it.
... View more
04-27-2020
05:16 PM
Nice
... View more
04-21-2020
10:17 AM
1 Like
Hello @jkoleti, I recommend you to read about the data step , % do loop and the merge statement. Regards
... View more
03-24-2020
05:24 AM
Nice contribution @JeffMeyers.
Will save time in data prep for curat.
Thanks.
... View more
02-17-2020
05:01 PM
Hi BIllPerkins,
Sorry for the acronyms.
I hope this helps for SAS Viya 3.4:
In the applications menu of SAS Environment Manager, select "Administration" -> "Manage Environment".
In the navigation bar, select "Content" from the navigation menu.
Click "Import". The Import wizard opens and "Select source" is selected.
In the "Import file": box , click to navigate on your file system to the "JSON" format file that you want to import.
Click"Open".
Then look for the repport object you need to proceed to the mappings step, by clicking "Mapping File" At the top of the window
At the top of the window, click "Results" to complete the mapping step.
Click the "Import" button at the top right-hand side of the window. If every object was successfully mapped, then the Results table is displayed by default with a list of the objects that were imported.
... View more
02-17-2020
09:48 AM
2 Likes
Simple Error Handling and Logging Strategy using SAS Studio
The Power to Know - SAS
When you write your first SAS programs using SAS Studio, sometimes you are asked to do Data Validation to grant essential Data Quality before the reporting phases. So by working on a Risk Data Project for regulatory Reporting, I have faced the need to enforce extra data Validation on top of an existing Data Validation Layer before executing the Load process to Historical Data Sets used for reporting on a Front-End Application or Client Application.
As a developer on the team of Data Preparation far from the SAS Data Integration Studio Developers Team, and surrounded by starving data Business users involved in the process with the need of not relying too much on more technical personnel and constantly asking for justifications, I came up with an idea of creating a friendly solution and easy to use using SAS Studio for error Logging.
Why?
Business Users want Simple to Use solutions to deal with useful and quality Data before submitting their Reports.
What?
The focus is on a Business User Perspective, who relies on well assessed and prepared input data for Model Execution.
SAS Studio is the tool to achieve the goal on a seamlessly manner with a Graphical User Interface (GUI) feature called Process Flow.
And lastly, a Validation Log Report Generation using Output Delivery System (ODS).
Summary
The focus will be how we as SAS Programmers can offer a simple solution to a Business user to be as comfortable with his input data as possible, before executing Models or Internal Processes for Regulatory Reporting.
A simple Process Flow will be shared to show you how you can organize your activities in a Sequential Step Flow to ensure Error Handling accordingly and generate a log report to share with the Data Integration developers in a fashion they can easily understand similar to SAS Data Integration Studio Job Flow Diagram to allow quick corrections on the JOB applications.
Use the Programming Interface: SAS Studio
First Things First:
In SAS Data Integration Studio, developers in a very but very simplified manner, create jobs, and jobs are sets of input data extractions, transformation and normally Output Table Loaders to create Output Information. A very essential Extraction, Transformation and Load concepts applied (ETL), but there is much more than that for future ArticlesJ.
Each of Extraction, Transformation and load action are organized in sequential Process Flow.
Figure 1. Sample Job Process Flow
So, in order to perform error handling and logging in SAS on a try/catch fashion used in Object Oriented Programming, you need to organize your statements in sequential Steps Just like is done in SAS Data Integration Studio, making it easier to catch the output error codes and messages to and write it to a Temporary/Permanent Dataset for reporting or logging.
Conclusions
The Idea focus on performing error handling in SAS on try/catch fashion used in Object Oriented Programming and by using Control Program Flow feature in SAS Studio, you can generate an interactive and easy to Graphical User Interface (GUI) to your business users even if they are not proficient in SAS Programming.
Figure 2.Process Flow Example
At the end of the flow, you can generate an execution Log or an Execution Report for monitoring or audit assessment.
References
I would recommend the following resources:
https://communities.sas.com/t5/SAS-Programming/Error-Handling-in-a-construct-like-try-catch/td-p/539151#
https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=n1wrevo4roqsnxn1fbd9yezxvv9k.htm&docsetVersion=9.4&locale=en
https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=p011imau3tm4jen1us2a45cyenz9.htm&docsetVersion=9.4&locale=en
SAS Output Delivery System: User's Guide
SAS® Data Integration Studio 4.904: User's Guide
Strategies for Error Handling and Program Control: Concepts - Paper 1565-2015
Want to try yourself the content of this post?
Code Sample
The following code simulates Two Activities:
The First task I present is the backup of an Input Dataset before manipulation or Changes in the Validation and Assessment process, before loading it to Permanent Datasets.
So I started by creating a SAS program and saving it in a specific folder on My SAS Server.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Task01:Backup Input Data Set before Changes */
/*Lib LOG Folder*/
libname LOG '/XXXX/XXXXXXX/XXXXX/LogRepporting';
/*Lib Backup Folder*/
libname Backup '/XXXXX/XXXXX/XXXXXXX/LogRepporting';
%macro logDataSet(dsn);
%if %sysfunc(exist(&dsn)) %then
%do;
/***exists***/
%end;
%else
%do;
data log.Task01;
attrib Task length=$8;
attrib Description length=$256;
attrib LIB length=$256;
attrib STEP length=$256;
attrib ErrorCode length=8;
call missing(of _all_);
stop;
run;
%end;
%mend;
%logDataSet(log.Task01);
/*Step1: Backup before any change*/
data Backup.testefinal;
set CODAT01.testefinal;
run;
%let error=&syserr;
%let ErrorDescription=&syserrortext;
%let libr =&syslibrc;
proc sql;
select CASE WHEN &error=0 then 'Sucess' ELSE "&ErrorDescription" end as
STEP into :STEPST from log.Task01;
select CASE WHEN &libr=0 then 'Success' ELSE "&ErrorDescription" end as
LIB into :Library from log.Task01;
insert into log.Task01 values('Task01','Task01:Backup Input Data Set before Changes',"&Library","&STEPST", &error
);
quit;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Secondly and lastly, I present a task to create the Log for Analysis and Repporting
/* Task02:Log Generation for Analisys and Repporting*/
ods pdf file="/XXXXX/XXXXXX/XXXXXXX/LogRepporting/LogRepport.pdf" author="Carlos Spranger";
Title'Log and Repporting';
PROC REPORT DATA=Log.Task01 NOWINDOWS HEADLINE;
COLUMN Task Description Lib STEP ErrorCode;
DEFINE Task / display "Task Name" width=8;
DEFINE Description / display "Task Description" width=32;
DEFINE LIB / display "Lib Status" width=14;
DEFINE STEP / display "Step Status" width=8;
DEFINE ErrorCode / display "ErrorCode" width=1;
RUN;
ods pdf close;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Then I create a Process Flow in Visual Designer Mode in SAS Studio and drag my SAS Programs to it.
Note that as good practice, I try to free resources just like the Dispose method used in most conventional Object Oriented Languages. Here a dispose My Datasets right after the report is successfully generated.
And then I can execute the logic in an End-User perspective:
Figure 3.Execute Process Flow Diagram in SAS Studio
... View more
02-14-2020
06:14 AM
Hello BillPerkins,
Please make sure If your backup package includes the corresponding 2G format file which is the VA report file format.
If you have those files included in your backup, your are able to restore your report.
And the use SASMC to import the files back to your environment.
Hope this is clear enough.
Regards,
CS
... View more
02-07-2020
07:55 PM
Hello adrfinance, data testInput; input qy $ balance; datalines; 2010Q1 100 2010Q1 100 2010Q2 150 2010Q2 150 2010Q3 50 2010Q3 50 2010Q4 20 2010Q4 20 2011Q1 300 2011Q2 300 run; proc sql; SELECT qy, balance, SUM (balance) as sum_balance_per_quarter from testInput GROUP BY qy; quit; Or you can improveit with subquery to show the overall Total Balance: proc sql; select qy,balance,sum_balance_per_quarter,SUM(sum_balance_per_quarter) as Total from (SELECT qy, balance, SUM (balance) as sum_balance_per_quarter from testInput GROUP BY qy) as Result; quit; Hope it helps Regards
... View more
03-27-2019
08:50 AM
@dgower2 , thanks for your reply, but I am wondering if a more precise feedback can be identified.
... View more