<?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: Call variables data by using SAS macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716850#M221625</link>
    <description>&lt;P&gt;Sure when share soon&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 17:18:00 GMT</pubDate>
    <dc:creator>pdhokriya</dc:creator>
    <dc:date>2021-02-04T17:18:00Z</dc:date>
    <item>
      <title>Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/713996#M220358</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PFA here test tab has raw data and result tab has expected data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have redundant data more than 100 records. How shall I manage this data by using macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share/explain program by using given raw data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Priyanka&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Raw data&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pdhokriya_0-1611595311618.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53883i92725EBF5B905CC8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pdhokriya_0-1611595311618.png" alt="pdhokriya_0-1611595311618.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Expected data -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when case(raw) has "old" data,&amp;nbsp; thn "n" at the end of name(raw) that would new_name(result).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pdhokriya_1-1611595372993.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53884i398F488AE06D0552/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pdhokriya_1-1611595372993.png" alt="pdhokriya_1-1611595372993.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 17:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/713996#M220358</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-01-25T17:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714001#M220362</link>
      <description>&lt;P&gt;Please provide more explanation of the logic that lets you go from the input data to the output data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, do not provide data via screen captures and do not provide data as Excel files (which most people will not download). Provide data using &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 17:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714001#M220362</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-25T17:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714004#M220364</link>
      <description>for 1st record - &lt;BR /&gt;&lt;BR /&gt;if name = "abcd" and case = "new" then do;&lt;BR /&gt;new_name = "abcdn" ;&lt;BR /&gt;number_new = input(number,best.);&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;I am using same query many time to get final dataset. Is there any other option ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jan 2021 17:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714004#M220364</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-01-25T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714005#M220365</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;Can you see screenshot or attachment ? onwards i will not share any.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 17:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714005#M220365</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-01-25T17:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714007#M220366</link>
      <description>&lt;P&gt;So you are just taking the first letter of variable CASE and appending it to the text string in variable NAME?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 17:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714007#M220366</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-25T17:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714209#M220468</link>
      <description>ya its a part of my query. addition to that how shall I call my variable data ?</description>
      <pubDate>Tue, 26 Jan 2021 10:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714209#M220468</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-01-26T10:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714224#M220476</link>
      <description>&lt;P&gt;No macros needed. A DATA step will do the job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    length new_name $ 32;
    new_name=cats(name,substr(case,1,1));
    number_new=input(number,8.0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jan 2021 12:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/714224#M220476</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-26T12:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716473#M221435</link>
      <description>I think u miss understood my query.&lt;BR /&gt;&lt;BR /&gt;I had a qery when I have huge data how can i handle , to just avoid multiple steps &lt;BR /&gt;&lt;BR /&gt;i.e. if name = "abcd" and case = "new" then do;&lt;BR /&gt;new_name = "abcdn" ;&lt;BR /&gt;number_new = input(number,best.);&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;for above mentioned data to avoid multiple lines of program</description>
      <pubDate>Wed, 03 Feb 2021 15:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716473#M221435</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-02-03T15:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716737#M221556</link>
      <description>&lt;P&gt;What do you mean by "query".&amp;nbsp; Usually with SAS you work on DATASETS.&amp;nbsp; &amp;nbsp;You don't work on queries.&amp;nbsp; You might RUN a query, especially if you want to use PROC SQL instead of a DATA step or some other PROC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain what input data you have, best would be to provide a small but sufficient sample to explain the issue you are have.&amp;nbsp; Then explain what output you want from that data.&amp;nbsp; Provide the output that would be generated if you could get the logic to work (another reason to post a small example so you can figure out yourself what output you expect).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When posting data it best to post it as text, preferable as a data step that re-creates the dataset.&amp;nbsp; Then someone can re-create your example in their SAS session and give you a tested program.&amp;nbsp; When you post photographs of data then it will make it harder for people to help you.&amp;nbsp; &amp;nbsp;And many people will not (are not allowed to) download attachments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 05:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716737#M221556</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-04T05:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716738#M221557</link>
      <description>&lt;P&gt;It sounds like you have a variable NAME that does not form a unique key for your dataset.&amp;nbsp; That is the same value of NAME appears on multiple observations.&amp;nbsp; And you want to create a new dataset where the value of NAME is unique.&amp;nbsp; You seem to think you could get there by appending the first letter of the variable CASE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if your source dataset is named HAVE and the two variables are named NAME and CASE then this data step will generate a new variable named NEW_NAME the appends the first letter of CASE to the end of NAME.&amp;nbsp; Since you didn't show how NAME is defined I just assumed that a length of 30 bytes would be enough NEW_NAME.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  length new_name $30 ;
  new_name=cats(name,char(case,1));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you can explain more about the overall operation you are trying to do perhaps there is another way, or a better way.&amp;nbsp; For example if the goal is just to uniquely identify the observations in the dataset why not just use both NAME and CASE as the key variables (BY variables)?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 05:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716738#M221557</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-04T05:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716755#M221569</link>
      <description>&lt;P&gt;This is going nowhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide data in usable form (data step with datalines), and the end result you want to get out of it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without knowing the "here" and "there", it is virtually impossible to show you how to get there from here.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 08:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716755#M221569</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-04T08:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Call variables data by using SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716850#M221625</link>
      <description>&lt;P&gt;Sure when share soon&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 17:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-variables-data-by-using-SAS-macro/m-p/716850#M221625</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2021-02-04T17:18:00Z</dc:date>
    </item>
  </channel>
</rss>

