<?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 Re: how to create flag variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353319#M273862</link>
    <description>&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 17:29:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-04-25T17:29:09Z</dc:date>
    <item>
      <title>how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353256#M273860</link>
      <description>&lt;P&gt;So I am a novice at SAS computations, yet have managed to run most of my statistics no problem until now;&amp;nbsp; I have encountered interaction effects in my analysis. I am utilizing a weighted dataset and was told I need to create flag variables to stratify my data for sex and race. Hoping someone here can help me know how the coding should look? It also has a PSU, and a Stratum variable on top of the weight variable. I have no idea how to create flag variables though. I am also using logistic regression so I need to know how to create the flag variable and then run a logistic regression so that I can get odds ratios for each stratified varible(sex, and all the different races). If this helps I am also utilizing the CDC's YRBS, which is a free dataset available to all, if anyone here feels so inclined to attempt on their own.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 15:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353256#M273860</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T15:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353271#M273861</link>
      <description>&lt;P&gt;Many SAS procedure don't need "flag variables", by which I assume you mean categorical levels of a variable (not numeric levels of a variable). So if you need to perform analyses by sex and race, these are handled in SAS by categorical variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if you are using PROC GLM or PROC GLIMMIX (or many other procedures), you simply put the categorical variables into a CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, is that what you mean? And what do you mean by PSU? (Pennsylvania State University? Or something else?)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 16:24:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353271#M273861</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-25T16:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353319#M273862</link>
      <description>&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353319#M273862</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T17:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353323#M273863</link>
      <description>&lt;P&gt;So the dataset I'm using as three classification one is a weight variable, one is a psu "sampling frame unit" and the other is a stratum or cluster. So I understand what the coding looks like for logistic regression I understand there is a class statement and a model statement but I cant simply stratify the dataset as one normally would becuase its a weighted sample. Someone told me the only way to stratify a weighted sample is using something called a flag variable, which I think is similair to creating dummy variables, but again in theory I undestand but how to actually execute it into sas I am completely lost.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353323#M273863</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T17:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353331#M273864</link>
      <description>&lt;P&gt;Are you looking at PROC SURVEYLOGISTIC vs LOGISTIC?&lt;/P&gt;
&lt;P&gt;SURVEYLOGISTIC is designed to deal with weights and in general, survey data.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353331#M273864</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T17:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353332#M273865</link>
      <description>&lt;P&gt;I am doing proc surveylogistic, because of the weight&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353332#M273865</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T17:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353333#M273866</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140836"&gt;@j4sanford&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;... but I cant simply stratify the dataset as one normally would becuase its a weighted sample&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And not knowing your problem in detail, I would say you can do this with a weighted sample. Many procedures have a WEIGHT statement which should take care of the weighting properly. It would seem to me that PROC LOGISTIC with a CLASS statement and a WEIGHT statement would allow you to properly analyze the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But ... we have reached the point where you need to be very very very specific about what the actual problem is, state the model and the design of the study, so we can actually understand what you are doing. We need DETAILS, DETAILS, DETAILS, emphasis on the word "DETAILS". We need a&amp;nbsp;complete and thorough explanation, emphasis on "COMPLETE" and "THOROUGH".&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353333#M273866</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-25T17:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353337#M273867</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140836"&gt;@j4sanford&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am doing proc surveylogistic, because of the weight&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And PROC SURVEYLOGISTIC has a CLASS statement, and will handle weights from your survey properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of being stingy with information,&amp;nbsp;only letting us know you are using SURVEYLOGISTIC after several posts, please read my request from my previous message and describe the entire problem for us.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 17:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353337#M273867</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-25T17:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353365#M273868</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140836"&gt;@j4sanford&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So I am a novice at SAS computations, yet have managed to run most of my statistics no problem until now;&amp;nbsp; I have encountered interaction effects in my analysis. I am utilizing a weighted dataset and was told I need to create flag variables to stratify my data for sex and race. Hoping someone here can help me know how the coding should look? It also has a PSU, and a Stratum variable on top of the weight variable. I have no idea how to create flag variables though. I am also using logistic regression so I need to know how to create the flag variable and then run a logistic regression so that I can get odds ratios for each stratified varible(sex, and all the different races). &lt;STRONG&gt;If this helps I am also utilizing the CDC's YRBS&lt;/STRONG&gt;, which is a free dataset available to all, if anyone here feels so inclined to attempt on their own.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;YRBS requires use of something that can handle a complex sample since it is a multistage cluster sample. Proc Surveylogistic would be the tool I would grab first. Place the variables that you think you need dummy variables for on the CLASS statement. The dummies will be built internally when those class variables on the Model statement (assuming they are in the independent part of the statment), no need for additional variables in the data set. Note that a format applied to the class variables can be used to get different analyis groups.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353365#M273868</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-25T18:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353370#M273869</link>
      <description>&lt;P&gt;Alright I guess its best to begin by stating my variables.&amp;nbsp; All of&amp;nbsp;them are&amp;nbsp;dichotomized categorical variables. I have 5 exposure variables(plus two&amp;nbsp;demographics-sex and race) so&amp;nbsp;a total of 7,&amp;nbsp;on 1 outcome variable.&amp;nbsp;&amp;nbsp;I've ran through the typical stuff: I ran my proc corr,&amp;nbsp;chisq, proc surveylogistic of each exposure independently on the outcome, I then ran proc surveylogistic with the entire model(all five exposures plus demographics&amp;nbsp;on my outcome) and&amp;nbsp;my coding for the surveylogistic with the&amp;nbsp;entire model looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc surveylogsitic;&lt;/P&gt;&lt;P&gt;strata STRATUM;&lt;/P&gt;&lt;P&gt;cluster PSU;&lt;/P&gt;&lt;P&gt;weight WEIGHT;&lt;/P&gt;&lt;P&gt;class (I list all of my exposure variables) /param=reference;&lt;/P&gt;&lt;P&gt;model: outcome= expsoure variables;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my problem isnt getting the odds ratios of the entire model its that I then&amp;nbsp;checked for&amp;nbsp;interaction effects, and found interaction effects exist&amp;nbsp;among two demographic variables: sex and race. So normally to&amp;nbsp; tease out the interaction odds ratios, one would&amp;nbsp;use an "&amp;nbsp;if then" statement correct? but I was told that since I am using a weighted dataset, one simply cannot do this and must use a flag variable to create dummy variables or use LSMestimates to get odds ratios of each exposure variable on the outcome variable stratified by sex, and then stratified by race. But I really am just barely getting the hang of coding in SAS&amp;nbsp;for all the other tests and not sure how one creates dummy variables, let alone how to do it with a weighted dataset. So really my question is,&amp;nbsp;now that I have&amp;nbsp;discovered an interaction, how do I re-run my logistic regression so that I get an odds ratio of each of my exposure variables&amp;nbsp;on my outcome variable&amp;nbsp;for females, for males, for whites, for african americans, for hispanics, etc...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353370#M273869</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T18:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353394#M273870</link>
      <description>&lt;P&gt;Interactions between sex and race? or interaction between exposure and sex and other interactions between exposure and race? Which?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In either case, the MODEL statement in PROC SURVEYLOGISTIC can handle interactions, for example, if you want interaction between exposure variable #1 and sex, you add the term EXPOSURE1*SEX into the model (where EXPOSURE1 should be replaced by the actual name of the exposure variable).&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353394#M273870</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-25T18:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353404#M273871</link>
      <description>&lt;P&gt;apologies, the interaction was found between one of my exposure variables and sex and the other interaction was found between another exposure variable and race.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already ran the interaction and it's&amp;nbsp;identified, but then how do I get my odds ratios stratified by the interaction variables??/&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 19:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353404#M273871</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T19:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353426#M273872</link>
      <description>&lt;P&gt;Have you tried the OddsRatio Statement?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 19:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353426#M273872</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T19:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353433#M273873</link>
      <description>&lt;P&gt;I dont think so..what does the coding for that look like?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 19:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353433#M273873</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T19:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353434#M273874</link>
      <description>&lt;P&gt;My bad, PROC SURVEYLOGISTIC doesn't support an ODDSRATIO statement, you'll likely need an ESTIMATE statement instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your original question has been answered though, this is a new, different, question that would be best posted under Statistical Procedures Forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 20:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353434#M273874</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T20:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353454#M273875</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140836"&gt;@j4sanford&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;apologies, the interaction was found between one of my exposure variables and sex and the other interaction was found between another exposure variable and race.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I already ran the interaction and it's&amp;nbsp;identified, but then how do I get my odds ratios stratified by the interaction variables??/&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are unlikely to find an "automagic" way if that is what you are looking for. The * is used to indicate/request interactions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;model a = var1 var2 var3 var1*var3 var2*var3 ;&lt;/P&gt;
&lt;P&gt;would request the interactions of var1 and var2 with var3 for example.&lt;/P&gt;
&lt;P&gt;Nested effect requests use ()&lt;/P&gt;
&lt;P&gt;model a = var1 var2 var2(var1); would request var2 nested within var1.&lt;/P&gt;
&lt;P&gt;Lots of combination possible such as D*E(A*B*C).&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 20:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353454#M273875</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-25T20:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353478#M273876</link>
      <description>&lt;P&gt;yea I dont think you are understanding my problem, I have identified were the interaction lies. I dont need to test for interactions anymore, but what is the next step once an interaction is found? the data must be stratified by the variable that is showing interaction to tease out the difference. It indicates that a confound exist, or that the odds ratio differs depending on the dichotmized variable&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 22:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353478#M273876</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T22:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353488#M273877</link>
      <description>&lt;P&gt;yes! I was told an LSMestimate or a flag variable is what I need, but I dont know how to do this. A new thread has been submitted, if you figure out a way to do this please share thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 22:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353488#M273877</guid>
      <dc:creator>j4sanford</dc:creator>
      <dc:date>2017-04-25T22:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to create flag variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353691#M273878</link>
      <description>&lt;P&gt;If I was right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt; a flag variable"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;flag=catx('_', sex, age);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;lsmestimate age / at=sex ;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 13:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-flag-variables/m-p/353691#M273878</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-26T13:45:08Z</dc:date>
    </item>
  </channel>
</rss>

