• Home
  • About Us
  • Contact Us
  • DMCA
  • Sitemap
  • Privacy Policy
Wednesday, March 22, 2023
Insta Citizen
No Result
View All Result
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence
No Result
View All Result
Insta Citizen
No Result
View All Result
Home Artificial Intelligence

Write to the log from SAS IML applications

Insta Citizen by Insta Citizen
January 28, 2023
in Artificial Intelligence
0
Write to the log from SAS IML applications
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter



I beforehand mentioned tips on how to use the PUTLOG assertion to put in writing a message from the DATA step to the log in SAS. The PUTLOG assertion is usually used to put in writing notes, warnings, and errors to the log.
This text exhibits tips on how to use the PRINTTOLOG subroutine in SAS IML software program to put in writing messages to the log.
The PRINTTOLOG subroutine
was launched in 2020 in SAS IML on SAS Viya. It runs in PROC IML and within the iml motion on Viya. The PRINTTOLOG subroutine just isn’t a part of SAS 9.4, however I present tips on how to assemble a SAS/IML module for SAS 9.4 that has the identical syntax and performance.

The PrintToLog subroutine in SAS IML on Viya


The syntax of the subroutine is

    name PrintToLog(msg, flag);


The flag parameter is non-obligatory. In case you omit that argument, the message is displayed within the log. In case you use the
flag parameter, the legitimate values are 0, 1, and a pair of:

  • If flag is 0, the string “NOTE: ” is prepended to the message. For instance, name PrintToLog("It is a observe.", 0);.
  • If flag is 1, the string “WARNING: ” is prepended to the message. For instance,
    name PrintToLog("It is a warning.", 1);.
  • If flag is 2, the string “ERROR: ” is prepended to the message.
    For instance, name PrintToLog("That is an error.", 2);.


I’ll illustrate the routine through the use of an IML model of this system that I utilized in my earlier put up concerning the PUTLOG assertion.
The enter to this system is a three-column matrix. Every row of the matrix accommodates the coefficients (a, b, c) for the quadratic equation
a x2 + b x + 3 = 0. This system is vectorized. It makes use of the discriminant of the quadratic equation to find out whether or not the quadratic equation has any actual roots. If that’s the case, this system makes use of the quadratic system to search out the roots. To show the PrintToLog operate, this system does the next:

  • Show an ERROR if any coefficient of the quadratic time period is 0.
  • Show a WARNING if any quadratic equation doesn’t have any actual roots.
  • Show a NOTE if any quadratic equation has a repeated root.
proc iml;
/* NOTE: The PrintToLog subroutine is accessible in SAS IML in Viya. 
   It isn't obtainable as a built-in subroutine for SAS/IML in SAS 9.4. */
Q = { 1 -1 -6,    /* every row is (a,b,c) */
      1  7  6,
      0  7  6,
      2  7  7,
     -2  5 12,
     -2  4 -2,
      5  4 10};
a = Q[,1]; b = Q[,2]; c = Q[,3];
Root1 = j(nrow(a), 1, .); /* initialize roots to lacking */
Root2 = j(nrow(a), 1, .); /* initialize roots to lacking */
 
if any(a=0) then
   name PrintToLog("The coefficient of the quadratic time period is 0 for no less than one statement", 2); /* show ERROR */
 
discrim = b##2 - 4*a#c;
if any(discrim < 0) then 
   name PrintToLog("A minimum of one equation doesn't have actual roots.", 1); /* show WARNING */
if any(discrim=0) then 
   name PrintToLog("A minimum of one equation has repeated roots.", 0); /* show NOTE */
 
idx = loc(discrim >= 0 && a^=0);
if ncol(idx)>0 then do;
	Root1[idx] = (-b[idx] - sqrt(discrim[idx])) / (2*a[idx]);
	Root2[idx] = (-b[idx] + sqrt(discrim[idx])) / (2*a[idx]);
finish;
print a b c discrim Root1 Root2;


The SAS log accommodates the next message, which is color-coded based on whether or not the message is an error (purple coloration), a warning (inexperienced coloration), or a observe (blue coloration).


For completeness, the output of this system is proven under.

A PrintToLog module for SAS 9.4


Though the PrintToLog subroutine just isn’t a built-in subroutine in SAS 9.4, you’ll be able to outline a module that has the identical performance.
The definition makes use of two SAS/IML methods and one macro trick:


The next SAS macro defines a SAS/IML module in SAS 9.4, however not in SAS Viya. Thus, you’ll be able to run this macro in any PROC IML program. If this system runs in Viya (the place the PrintToLog subroutine is already outlined), the macro does nothing. If this system runs in SAS 9.4, the macro defines a PrintToLog module that you need to use to put in writing messages to the log.

/* Test the SYSVER macro to see if SAS 9.4 is operating.
   In SAS Viya, the macro is empty and does nothing.
   In SAS 9.4, the macro defines a operate that emulates the PrintToLog name.
   The syntax is as follows:
   name PrintToLog("It is a log message.");
   name PrintToLog("It is a observe.", 0);
   name PrintToLog("It is a warning.", 1);
   name PrintToLog("That is an error.", 2);
*/
%macro DefinePrintToLog;
%if %sysevalf(&sysver = 9.4) %then %do;
begin PrintToLog(msg,errCode=-1);
   if      errCode=0 then prefix = "NOTE: ";
   else if errCode=1 then prefix = "WARNING: ";
   else if errCode=2 then prefix = "ERROR: ";
   else prefix = "";
   stmt = '%put ' + prefix + msg + ';';
   name execute(stmt);
end;
%finish;
%mend;
 
/* this program runs in SAS 9.4 or in SAS Viya */
proc iml;
%DefinePrintToLog;
name PrintToLog("It is a log message.");
name PrintToLog("It is a observe.", 0);
name PrintToLog("It is a warning.", 1);
name PrintToLog("That is an error.", 2);


The output is proven for SAS 9.4, the place the %DefinePrintToLog macro defines the SAS/IML module.

Abstract


The PRINTTOLOG assertion is manner for SAS IML programmers to put in writing messages to the log.
In SAS Viya, this subroutine is built-in and can be utilized from PROC IML or from the iml motion.
This text exhibits tips on how to outline a module for PROC IML in SAS 9.4 that has related performance.



Source_link

READ ALSO

Head-worn system can management cell manipulators — ScienceDaily

I See What You Hear: A Imaginative and prescient-inspired Technique to Localize Phrases

Related Posts

How deep-network fashions take probably harmful ‘shortcuts’ in fixing complicated recognition duties — ScienceDaily
Artificial Intelligence

Head-worn system can management cell manipulators — ScienceDaily

March 22, 2023
RGB-X Classification for Electronics Sorting
Artificial Intelligence

I See What You Hear: A Imaginative and prescient-inspired Technique to Localize Phrases

March 22, 2023
Quick reinforcement studying by means of the composition of behaviours
Artificial Intelligence

Quick reinforcement studying by means of the composition of behaviours

March 21, 2023
Exploring The Variations Between ChatGPT/GPT-4 and Conventional Language Fashions: The Affect of Reinforcement Studying from Human Suggestions (RLHF)
Artificial Intelligence

Exploring The Variations Between ChatGPT/GPT-4 and Conventional Language Fashions: The Affect of Reinforcement Studying from Human Suggestions (RLHF)

March 21, 2023
Detailed pictures from area provide clearer image of drought results on vegetation | MIT Information
Artificial Intelligence

Detailed pictures from area provide clearer image of drought results on vegetation | MIT Information

March 21, 2023
Palms on Otsu Thresholding Algorithm for Picture Background Segmentation, utilizing Python | by Piero Paialunga | Mar, 2023
Artificial Intelligence

Palms on Otsu Thresholding Algorithm for Picture Background Segmentation, utilizing Python | by Piero Paialunga | Mar, 2023

March 21, 2023
Next Post
Small change, large impact – pv journal Worldwide

Small change, large impact – pv journal Worldwide

POPULAR NEWS

AMD Zen 4 Ryzen 7000 Specs, Launch Date, Benchmarks, Value Listings

October 1, 2022
Only5mins! – Europe’s hottest warmth pump markets – pv journal Worldwide

Only5mins! – Europe’s hottest warmth pump markets – pv journal Worldwide

February 10, 2023
XR-based metaverse platform for multi-user collaborations

XR-based metaverse platform for multi-user collaborations

October 21, 2022
Magento IOS App Builder – Webkul Weblog

Magento IOS App Builder – Webkul Weblog

September 29, 2022
Melted RTX 4090 16-pin Adapter: Unhealthy Luck or the First of Many?

Melted RTX 4090 16-pin Adapter: Unhealthy Luck or the First of Many?

October 24, 2022

EDITOR'S PICK

Specialists share insights on Firebase, Flutter and the developer neighborhood

Specialists share insights on Firebase, Flutter and the developer neighborhood

November 27, 2022
UPSC Mains 2022 Normal Research Paper 2

High MBA Schools after Engineering

February 25, 2023
India’s Paytm to spend as much as $103 million to purchase again shares • TechCrunch

India’s Paytm to spend as much as $103 million to purchase again shares • TechCrunch

December 14, 2022
UPSC Mains 2022 Normal Research Paper 2

Quartile Deviation and Coefficient of Quartile Deviation: That means, Formulation, Calculation, and Examples

February 7, 2023

Insta Citizen

Welcome to Insta Citizen The goal of Insta Citizen is to give you the absolute best news sources for any topic! Our topics are carefully curated and constantly updated as we know the web moves fast so we try to as well.

Categories

  • Artificial Intelligence
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Technology

Recent Posts

  • Report: 72% of tech leaders plan to extend funding in tech abilities growth
  • Head-worn system can management cell manipulators — ScienceDaily
  • Drop Lord Of The Rings Black Speech Keyboard
  • LG made a 49-inch HDR monitor with a 240Hz refresh price
  • Home
  • About Us
  • Contact Us
  • DMCA
  • Sitemap
  • Privacy Policy

Copyright © 2022 Instacitizen.com | All Rights Reserved.

No Result
View All Result
  • Home
  • Technology
  • Computers
  • Gadgets
  • Software
  • Solar Energy
  • Artificial Intelligence

Copyright © 2022 Instacitizen.com | All Rights Reserved.

What Are Cookies
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT