{"id":5430,"date":"2024-11-07T10:00:05","date_gmt":"2024-11-07T15:00:05","guid":{"rendered":"https:\/\/cytel.agencyukdev.com\/?post_type=perspectives&#038;p=5430"},"modified":"2024-11-07T13:48:40","modified_gmt":"2024-11-07T18:48:40","slug":"p_macro-parameters-extraction-from-macros-to-sas-dataset","status":"publish","type":"perspectives","link":"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/","title":{"rendered":"P_MACRO: Parameters Extraction from Macros to SAS Dataset"},"content":{"rendered":"<p>In clinical development, SAS programmers manage, analyze, and interpret clinical data, helping to ensure accuracy, which is essential for regulatory submission and approval. SAS programmers may also create new programs to conduct this work more efficiently and effectively.<\/p>\n<p><a href=\"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/sas-vs-r-in-clinical-development\/\" target=\"_blank\" rel=\"noopener\">SAS<\/a> has a powerful programming feature called Macros, which allows programmers to avoid repetitive sections of code and to use them again and again when needed. It also helps create dynamic variables within the code that can take different values for different run instances of the same code.<\/p>\n<p>Parameters are local to the macro that defines them. A parameter list can contain any number of macro parameters separated by commas. These macro parameters are variables whose values are initialized when we invoke the macro and provide flexibility to supply different values at each invocation. However, there is currently no automated facility within SAS where a complete list of macro parameters defined for a group of macros can be easily checked<\/p>\n<p>Our solution is P_MACRO, which has been programmed to help <a href=\"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/automating-log-checks-a-case-for-innovation-in-statistical-programming\/\" target=\"_blank\" rel=\"noopener\">programmers<\/a> refer to the complete list of parameters defined within a macro program within the SAS environment itself. Here, I discuss what P_MACRO is capable of, why it\u2019s needed, how it\u2019s programmed, and its limitations.<\/p>\n<p>&nbsp;<\/p>\n<h2>What is P_MACRO and what does it do?<\/h2>\n<p>P_MACRO is an SAS program that extracts parameter-level information from a group of macros and saves them to an SAS dataset.\u00a0Once set up, P_MACRO accomplishes several tasks, including:<\/p>\n<ol>\n<li>Extracting parameters from the group of macro programs to the SAS dataset.<\/li>\n<li>Extracting default values along with parameters, if already defined.<\/li>\n<li>Retaining the order of parameters.<\/li>\n<li>Prioritizing main macro information over nested macros.<\/li>\n<li>Providing a common text for macro programs without parameters.<\/li>\n<li>Generating an automated macro call.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Why is P_MACRO needed?<\/h2>\n<p>In SAS macros, we have the flexibility to exclude some parameters at invocation and the macro will still execute well, if there is no dependency. But when we do not include the complete list of parameters in a call, it is difficult for the programmer to decide on adding parameters to the existing call when an update\/modification is needed. If the programmer is not aware of the complete list of parameters when an update is needed, then they may need to either use debugging options or manually open the macro code and check.<\/p>\n<p>However, we do not have an automated facility within SAS where we can check the complete list of macro parameters defined for a group of macros. Thus P_MACRO, when released for wider group usage, will help programmers gather and refer to the complete list of parameters defined within a macro program in the SAS environment itself. With this, it will be easy to get ahold of the complete list of parameters defined along with their default values and position\/order.\u00a0An automatic macro call for each macro is generated using the information stored in resultant dataset, saving valuable time for the programmer.<\/p>\n<p>&nbsp;<\/p>\n<h2>Steps involved in P_MACRO programming<\/h2>\n<ol>\n<li>Read macro program files to SAS<\/li>\n<li>Extract macro name<\/li>\n<li>Determine macro start and end points<\/li>\n<li>Handle nested macros<\/li>\n<li>Handle macro programs with no parameters<\/li>\n<li>Retain macro parameters position<\/li>\n<li>Bring out default values<\/li>\n<li>Generate macro call<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Limitations<\/h2>\n<p>Despite its benefits, the P_MACRO program has a few limitations:<\/p>\n<ol>\n<li>%LET statement is used in macro programs to conditionally check and assign a default value for a parameter. Such default values are not extracted through the macro.<\/li>\n<li>SAS Macros has the ability to use the PARMBUFF option and SYSPBUFF to define a macro that accepts a varying number of parameters at each invocation. In such cases, P_MACRO won\u2019t be able to extract any parameters.<\/li>\n<\/ol>\n<p><strong>\u00a0<\/strong><\/p>\n<h2>Final takeaways<\/h2>\n<p>In the SASHELP library, there is a dataset named VCOLUMN that holds detailed information about the metadata of the libraries, datasets, and variables present for that SAS session. This helps programmers to identify\/query some of the important information about the datasets\/variables for that active session. Like the VCOLUMN dataset, the dataset generated through P_MACRO will help programmers find the list of macros within one folder, with their entire list of parameters in defined order along with default values in one place within SAS. Generating an automated macro call using the resultant dataset would help programmers by having the entire parameters list handy and ready to use as needed.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Interested in learning more?\u00a0\u00a0<\/strong><\/h3>\n<p>Eswara Gunisetti will be at PHUSE EU 2024 to present \u201cP_MACRO, Parameters Extraction from Macros to SAS Dataset\u201d on Wednesday, November 13 at 12:00 p.m. We hope to see you there!<\/p>","protected":false},"featured_media":3713,"parent":0,"template":"","meta":{"_acf_changed":false},"tags":[76],"by-topic":[437,459],"by-year":[74],"class_list":["post-5430","perspectives","type-perspectives","status-publish","has-post-thumbnail","hentry","tag-blog","by-topic-fsp","by-topic-statistical-programming","by-year-74"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us<\/title>\n<meta name=\"description\" content=\"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us\" \/>\n<meta property=\"og:description\" content=\"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/\" \/>\n<meta property=\"og:site_name\" content=\"Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-07T18:48:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cytel.agencyukdev.com\/wp-content\/uploads\/2024\/05\/iStock-1470900662_abstract.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2337\" \/>\n\t<meta property=\"og:image:height\" content=\"1283\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset\\\/\",\"url\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset\",\"name\":\"P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/iStock-1470900662_abstract.jpg\",\"datePublished\":\"2024-11-07T15:00:05+00:00\",\"dateModified\":\"2024-11-07T18:48:40+00:00\",\"description\":\"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage\",\"url\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/iStock-1470900662_abstract.jpg\",\"contentUrl\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/iStock-1470900662_abstract.jpg\",\"width\":2337,\"height\":1283,\"caption\":\"abstract vector background with hexagons. 3d design\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/perspectives\\\/p_macro-parameters-extraction-from-macros-to-sas-dataset#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"P_MACRO: Parameters Extraction from Macros to SAS Dataset\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/#website\",\"url\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/\",\"name\":\"Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us\",\"description\":\"Innovative Trial Design. Cytel is the largest provider of statistical software and advanced analytics for clinical trial design and execution.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cytel.agencyukdev.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us","description":"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/","og_locale":"fr_FR","og_type":"article","og_title":"P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us","og_description":"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.","og_url":"https:\/\/cytel.agencyukdev.com\/fr\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/","og_site_name":"Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us","article_modified_time":"2024-11-07T18:48:40+00:00","og_image":[{"width":2337,"height":1283,"url":"https:\/\/cytel.agencyukdev.com\/wp-content\/uploads\/2024\/05\/iStock-1470900662_abstract.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset\/","url":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset","name":"P_MACRO: Parameters Extraction from Macros to SAS Dataset - Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us","isPartOf":{"@id":"https:\/\/cytel.agencyukdev.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage"},"image":{"@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage"},"thumbnailUrl":"https:\/\/cytel.agencyukdev.com\/wp-content\/uploads\/2024\/05\/iStock-1470900662_abstract.jpg","datePublished":"2024-11-07T15:00:05+00:00","dateModified":"2024-11-07T18:48:40+00:00","description":"P_MACRO, a new SAS program, will help programmers refer to the complete list of parameters defined within a macro program.","breadcrumb":{"@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset#primaryimage","url":"https:\/\/cytel.agencyukdev.com\/wp-content\/uploads\/2024\/05\/iStock-1470900662_abstract.jpg","contentUrl":"https:\/\/cytel.agencyukdev.com\/wp-content\/uploads\/2024\/05\/iStock-1470900662_abstract.jpg","width":2337,"height":1283,"caption":"abstract vector background with hexagons. 3d design"},{"@type":"BreadcrumbList","@id":"https:\/\/cytel.agencyukdev.com\/perspectives\/p_macro-parameters-extraction-from-macros-to-sas-dataset#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/cytel.agencyukdev.com\/"},{"@type":"ListItem","position":2,"name":"P_MACRO: Parameters Extraction from Macros to SAS Dataset"}]},{"@type":"WebSite","@id":"https:\/\/cytel.agencyukdev.com\/#website","url":"https:\/\/cytel.agencyukdev.com\/","name":"Clinical Trial Software &amp; Data Analysis | Cytel | Contact Us","description":"Innovative Trial Design. Cytel is the largest provider of statistical software and advanced analytics for clinical trial design and execution.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cytel.agencyukdev.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"}]}},"_links":{"self":[{"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/perspectives\/5430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/perspectives"}],"about":[{"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/types\/perspectives"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/media\/3713"}],"wp:attachment":[{"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/media?parent=5430"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/tags?post=5430"},{"taxonomy":"by-topic","embeddable":true,"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/by-topic?post=5430"},{"taxonomy":"by-year","embeddable":true,"href":"https:\/\/cytel.agencyukdev.com\/fr\/wp-json\/wp\/v2\/by-year?post=5430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}