<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681293#M206056</link>
    <description>&lt;P&gt;Hello programmers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know next to nothing about SAS macros and i know this is very easy. I downloaded the BRFFS dataset from CDC website and creating file names and libnames have been difficult because it was done in SAS macro.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone let me know what these codes are? I figured out the libname part but the first 3 lines have been confusing. What is Qdrive?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%let Multiple_year_CYYYY  = 2012_2014;
%let Multiple_year_CYYYY  = 2016;

libname LIBRARY "C:\Users\Manuel\Downloads\AsthmaBRFSS" ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Sep 2020 11:34:29 GMT</pubDate>
    <dc:creator>ChuksManuel</dc:creator>
    <dc:date>2020-09-03T11:34:29Z</dc:date>
    <item>
      <title>Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681293#M206056</link>
      <description>&lt;P&gt;Hello programmers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know next to nothing about SAS macros and i know this is very easy. I downloaded the BRFFS dataset from CDC website and creating file names and libnames have been difficult because it was done in SAS macro.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone let me know what these codes are? I figured out the libname part but the first 3 lines have been confusing. What is Qdrive?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%let Multiple_year_CYYYY  = 2012_2014;
%let Multiple_year_CYYYY  = 2016;

libname LIBRARY "C:\Users\Manuel\Downloads\AsthmaBRFSS" ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2020 11:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681293#M206056</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T11:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681296#M206057</link>
      <description>&lt;P&gt;The first three lines create &lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1jgr545j3yz29n1uic9qlvlrzo4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;macro variables&lt;/A&gt;. You can reference the macro variables later with a preceding ampersand like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;Qdrive.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice though, that you attempt to create the macro variable Multiple_year_CYYYY twice. The second attempt overwrites the first, so the value of&amp;nbsp;Multiple_year_CYYYY will be '2016'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsglobal&amp;amp;docsetTarget=n1nk65k2vsfmxfn1wu17fntzszbp.htm&amp;amp;locale=da" target="_self"&gt;Libname Statement&lt;/A&gt;, you simple create a SAS library from the specified path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 11:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681296#M206057</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-09-03T11:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681297#M206058</link>
      <description>Is QDrive a syntax? or a drive like C:/?</description>
      <pubDate>Thu, 03 Sep 2020 11:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681297#M206058</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T11:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681300#M206060</link>
      <description>&lt;P&gt;Please can&amp;nbsp; anyone familiar with BRFSS data orient me to the macro codes above?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 12:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681300#M206060</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T12:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681301#M206061</link>
      <description>&lt;P&gt;Here, Qdrive is nothing but a macro variable. You can read about macro variables in the link I provide above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A macro variable contains text. It does not point to any drive. It is just text:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%put &amp;amp;Qdrive.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2020 12:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681301#M206061</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-09-03T12:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681332#M206070</link>
      <description>&lt;P&gt;What data / code did you download?&amp;nbsp; There's a lot available, e.g. a lot of stuff in&amp;nbsp;&lt;A href="https://www.cdc.gov/brfss/annual_data/annual_2019.html" target="_blank"&gt;https://www.cdc.gov/brfss/annual_data/annual_2019.html&lt;/A&gt;&amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you post links to the data and code you downloaded, I'd be happy to take a look.&amp;nbsp; I'm always curious how people use SAS to share data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 13:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681332#M206070</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2020-09-03T13:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681348#M206074</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can anyone let me know what these codes are? I figured out the libname part but the first 3 lines have been confusing. What is Qdrive?&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%let Multiple_year_CYYYY  = 2012_2014;
%let Multiple_year_CYYYY  = 2016;

libname LIBRARY "C:\Users\Manuel\Downloads\AsthmaBRFSS" ;​&lt;/LI-CODE&gt;&lt;BR /&gt;Is QDrive a syntax? or a drive like C:/?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On Windows you can reference files using either the old style drive letters, like in your LIBNAME statement.&amp;nbsp; Or with a &lt;A href="https://www.lifewire.com/unc-universal-naming-convention-818230" target="_self"&gt;UNC&lt;/A&gt; , like in the value of your QDRIVE macro variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also notice that Windows uses \ and not / as the separator between directories in a path.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 14:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681348#M206074</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-03T14:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681352#M206076</link>
      <description>&lt;P&gt;1. Move your file out of downloads otherwise you'll regret it when your data disappears one day&lt;/P&gt;
&lt;P&gt;2. QDRIVE is a path, usually the macro has comments that explain what each parameter is and how to specify it, especially a lot of the government code. It seems like it's a path to where you're storing your programs most likely and it's a way for the program to reference folders/files without hardcoding every single path.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know next to nothing about SAS macros and i know this is very easy. I downloaded the BRFFS dataset from CDC website and creating file names and libnames have been difficult because it was done in SAS macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone let me know what these codes are? I figured out the libname part but the first 3 lines have been confusing. What is Qdrive?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%let Multiple_year_CYYYY  = 2012_2014;
%let Multiple_year_CYYYY  = 2016;

libname LIBRARY "C:\Users\Manuel\Downloads\AsthmaBRFSS" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 14:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681352#M206076</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-03T14:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681355#M206077</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;I am guessing you are having problems running some code, if you are then please provide a SAS log file.&lt;BR /&gt;The simple way to think about macro variables (e.g. Qdrive, Multiple_year_CYYYY) is their values are substituted into the code at compile time (i.e. before the code runs).&lt;BR /&gt;So you could just go through the code and manually change all the references from macro variables to hard coded values&lt;BR /&gt;&lt;BR /&gt;For example&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/* turn on symbolgen so you can see the macro vatiable resolution in the SAS log */
option symbolgen ;

/* Create macro variable */
%let my_macro_variable = Hello World;

data _null_ ;
	put "&amp;amp;my_macro_variable" ;
	my_variable="&amp;amp;my_macro_variable" ;
	put my_variable= ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2020 14:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681355#M206077</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2020-09-03T14:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681365#M206078</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Please can&amp;nbsp; anyone familiar with BRFSS data orient me to the macro codes above?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I've worked with BRFSS data for over 25 years. Never seen macros like that.&lt;/P&gt;
&lt;P&gt;If you downloaded those from the CDC website then you likely missed the documentation file they usually provide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If these are locally developed, i.e. your organization wrote them, macros then not a clue.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 14:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681365#M206078</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-03T14:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681447#M206119</link>
      <description>This is the link to the dataset. I downloaded the adult 2016 dataset. &lt;A href="https://www.cdc.gov/brfss/acbs/2016_documentation.html" target="_blank"&gt;https://www.cdc.gov/brfss/acbs/2016_documentation.html&lt;/A&gt;. I had to ditch the sas dataset for the SPSS dataset.</description>
      <pubDate>Thu, 03 Sep 2020 18:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681447#M206119</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T18:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681450#M206121</link>
      <description>Hello,&lt;BR /&gt;This is the link to the sas datasets that i downloaded. &lt;A href="https://www.cdc.gov/brfss/acbs/2016_documentation.html" target="_blank"&gt;https://www.cdc.gov/brfss/acbs/2016_documentation.html&lt;/A&gt;. CDC did not provide any guideline on how to handle these.</description>
      <pubDate>Thu, 03 Sep 2020 18:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681450#M206121</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T18:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681468#M206128</link>
      <description>Is the code in your question code you downloaded from that page, or is it code someone in your organization wrote?</description>
      <pubDate>Thu, 03 Sep 2020 19:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681468#M206128</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2020-09-03T19:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681493#M206134</link>
      <description>&lt;P&gt;The code applies formats and labels to your data sets. You can create the format and labels in any library that makes sense to you and then apply the formats and labels as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Qdrive  = \\Cdc\project\CCHP_NCCD_DACH_BRFSS;
%let Multiple_year_CYYYY  = 2012_2014;
%let Multiple_year_CYYYY  = 2016;

libname LIBRARY "&amp;amp;Qdrive\BRFSS\Projects\Asthmacell\&amp;amp;Multiple_year_CYYYY\library" ;

ods listing;
PROC PRINTTO; RUN ;

 Proc FORMAT LIBRARY = LIBRARY.LIBRARY;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Change to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Proc FORMAT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Run PROCFORMAT program first, Then the FMT..ADULT&amp;nbsp; then the LABEL..ADULT one for Adult.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'path to sas7bdatfiles';

data want;
set mylib. acbs_2016_adult_public_llcp;

%format_adult;
%label_adult;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Repeat for child data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hello,&lt;BR /&gt;This is the link to the sas datasets that i downloaded. &lt;A href="https://www.cdc.gov/brfss/acbs/2016_documentation.html" target="_blank" rel="noopener"&gt;https://www.cdc.gov/brfss/acbs/2016_documentation.html&lt;/A&gt;. CDC did not provide any guideline on how to handle these.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 20:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681493#M206134</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-03T20:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681506#M206138</link>
      <description>&lt;P&gt;You are awesome! Thank you everyone!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 20:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/681506#M206138</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2020-09-03T20:58:40Z</dc:date>
    </item>
  </channel>
</rss>

