<?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: Excel formula in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919156#M362051</link>
    <description>&lt;P&gt;If the size of the "VLOOKUP" "tables" are reasonable in size then just make them into formats.&amp;nbsp; So let's convert your example listings into PROC FORMAT code.&amp;nbsp; &amp;nbsp;Then we can just code you IF/THEN sequence exactly as you have written it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;resetline;

data HAVE;
  infile cards dsd truncover;
  length NAME $20 CODE $8 LOCATION $8 ;
  input NAME CODE LOCATION;
cards;
First,1234,1A
First Number,1346,11A
Second Number,1235,B4
Second,1345,B7
;

proc format;
 value $name 
   '1234'='No'
   '1236'='Yes'
   '1345'='No'
   '1348'='Yes'
 ;

 value $location 
   '1234'='No'
   '1348'='Yes'
   '1236'='Yes'
   '1345'='No'
  ;

  value $matching
    '1A' ='Yes'
    '11A'='No'
    'B4' ='No'
    'B7' ='Yes'
  ;
run;

data want;
  set have;
  length result $3 ;
  if scan(NAME,-1,' ')='Number' then result='No';
  else if put(code,$name.)='Yes' then result='No';
  else if put(code,$location.)='Yes' then result='No';
  else result=put(location,$matching.) ;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    NAME             CODE    LOCATION    result

 1     First            1234      1A         Yes
 2     First Number     1346      11A        No
 3     Second Number    1235      B4         No
 4     Second           1345      B7         Yes
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: Since you already have the lookups in a WORKSHEET you can look at the CNTLIN= option of PROC FORMAT in the documentation to learn how to create the formats from the existing dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2024 16:47:09 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-03-06T16:47:09Z</dc:date>
    <item>
      <title>Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919115#M362033</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone help me to write below excel formula in SAS.&lt;/P&gt;
&lt;P&gt;a2 has "&lt;STRONG&gt;First Number&lt;/STRONG&gt;" and some other values like First, second, third, &lt;STRONG&gt;Third Number&lt;/STRONG&gt;, etc.&lt;/P&gt;
&lt;P&gt;b2 has some values like '1234' these are char format and Names a:b has '1234' and something like '1346'&amp;nbsp; chat format and 2 is Yes/No&lt;/P&gt;
&lt;P&gt;b2 has some values like '1234' these are char format and Names a:b has '1234' and something like '1346'&amp;nbsp; chat format and 2 is Yes/No&lt;/P&gt;
&lt;P&gt;&amp;nbsp;c2 is also char format and a values from matching sheet will matching with c2 values and 2 is Yes/No&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=if(right(a2,6)="Number","no",&lt;BR /&gt;if(iferror(vlookup(b2,'Names'!$a:$b,2,false),"no")="yes","no",&lt;BR /&gt;if(iferror(vlookup(b2,'Location'!$a:$b,2,false),"no")="yes","no",&lt;BR /&gt;vlookup(c2,'Matching'!$a:$b,2,false))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main data&lt;/P&gt;
&lt;TABLE width="235"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="107"&gt;A&lt;/TD&gt;
&lt;TD width="64"&gt;B&lt;/TD&gt;
&lt;TD width="64"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;First&lt;/TD&gt;
&lt;TD&gt;1234&lt;/TD&gt;
&lt;TD&gt;1A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;First Number&lt;/TD&gt;
&lt;TD&gt;1348&lt;/TD&gt;
&lt;TD&gt;11A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Second Number&lt;/TD&gt;
&lt;TD&gt;1236&lt;/TD&gt;
&lt;TD&gt;B4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Second&lt;/TD&gt;
&lt;TD&gt;1345&lt;/TD&gt;
&lt;TD&gt;B7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Names data&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1348&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1236&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1345&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Location data&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1348&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1236&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1345&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Matching data&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;1A&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;11A&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B4&lt;/TD&gt;
&lt;TD&gt;No&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B7&lt;/TD&gt;
&lt;TD&gt;Yes&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;vnreddy&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 16:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919115#M362033</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2024-03-06T16:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919125#M362037</link>
      <description>&lt;P&gt;Can you please rephrase your Excel syntax into pseudo-code or business language?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919125#M362037</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-03-06T15:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919127#M362038</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We first check if the last 6 characters of the column&amp;nbsp;&lt;STRONG&gt;a&lt;/STRONG&gt; equal "Number".&lt;BR /&gt;If they do, the result is set to "No".&lt;BR /&gt;If not, we check if the result of the VLOOKUP function on the 'Names' dataset based on column B&amp;nbsp; &amp;amp; a is "Yes".&lt;BR /&gt;If it is, the result is set to "No".&lt;BR /&gt;If not, we check if the result of the VLOOKUP function on the 'Location' dataset&amp;nbsp;based on column B&amp;nbsp; &amp;amp; a is "Yes".&lt;BR /&gt;If it is, the result is set to "No".&lt;BR /&gt;If neither of the above conditions is met, we perform another VLOOKUP on the 'Matching' dataset and set the result accordingly.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919127#M362038</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2024-03-06T15:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919134#M362042</link>
      <description>Not gfiving you the full solution, but something to start with:&lt;BR /&gt;First join all datasets on&lt;BR /&gt;main.b = names.a and&lt;BR /&gt;main.b = location.a and&lt;BR /&gt;main.c = matching.a&lt;BR /&gt;&lt;BR /&gt;The scan() function lets you search a string for the n-the word.&lt;BR /&gt;If you chose to use SQL then CASE statements will help. &lt;BR /&gt;In a data step use IF-statments.</description>
      <pubDate>Wed, 06 Mar 2024 15:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919134#M362042</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-03-06T15:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919137#M362045</link>
      <description>&lt;P&gt;Just explain WHAT you are trying to do.&amp;nbsp; HOW to do it is what you are trying to learn.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you want to describe the data accurately then share it as data step code that recreates the dataset.&amp;nbsp; That way the dataset names, variable names, variable types and whether any of the variables need special display formats attached is clear.&amp;nbsp; And use reasonable names for the variables. A, B and C are not good names as they impart no information about what the variable contains.&amp;nbsp; (I also do not understand what your datasets named LOCATION and NAMES really mean either.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like you have three datasets. Perhaps something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  infile cards dsd truncover;
  length NAME $20 CODE $8 LOCATION $8 ;
  input NAME CODE LOCATION;
cards;
First,1234,1A
First Number,1346,11A
Second Number,1235,B4
Second,1345,B7
;

data names ;
  length CODE $8 NAME_STATUS $3 ;
  input CODE name_status;
cards;
1234 No
1348 Yes
1236 Yes
1345 No
; 

data location ;
  length CODE $8 LOCATION_STATUS $3 ;
  input code location_status;
cards;
1234 No
1348 Yes
1236 Yes
1345 No
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Looks like they only have the CODE variable in common.&lt;/P&gt;
&lt;P&gt;So try sorting by that variable and merging.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by code; run;
proc sort data=names; by code; run;
proc sort data=location; by code; run;

data want;
  merge have names location;
  by code;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;                                            NAME_     LOCATION_
Obs    NAME             CODE    LOCATION    STATUS     STATUS

 1     First            1234      1A         No          No
 2     Second Number    1235      B4
 3                      1236                 Yes         Yes
 4     Second           1345      B7         No          No
 5     First Number     1346      11A
 6                      1348                 Yes         Yes
&lt;/PRE&gt;
&lt;P&gt;Is that what you are trying to do?&lt;/P&gt;
&lt;P&gt;If not what is it you are doing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919137#M362045</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-06T15:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919149#M362047</link>
      <description>&lt;P&gt;sorry my bad, now i have corrected main dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need one new variable in main dataset with status Yes/No, if below conditions matches.&lt;/P&gt;
&lt;P&gt;In my original dataset i have almost 40 variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We first check if the last 6 characters of the column&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;equal "Number".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If they do, the result is set to "No".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If not, we check if the result of the VLOOKUP function on the 'Names' dataset based on column B&amp;nbsp; &amp;amp; a is "Yes".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If it is, the result is set to "No".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If not, we check if the result of the VLOOKUP function on the 'Location' dataset&amp;nbsp;based on column B&amp;nbsp; &amp;amp; a is "Yes".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If it is, the result is set to "No".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If neither of the above conditions is met, we perform another VLOOKUP on the 'Matching' dataset and set the result accordingly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 16:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919149#M362047</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2024-03-06T16:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919156#M362051</link>
      <description>&lt;P&gt;If the size of the "VLOOKUP" "tables" are reasonable in size then just make them into formats.&amp;nbsp; So let's convert your example listings into PROC FORMAT code.&amp;nbsp; &amp;nbsp;Then we can just code you IF/THEN sequence exactly as you have written it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;resetline;

data HAVE;
  infile cards dsd truncover;
  length NAME $20 CODE $8 LOCATION $8 ;
  input NAME CODE LOCATION;
cards;
First,1234,1A
First Number,1346,11A
Second Number,1235,B4
Second,1345,B7
;

proc format;
 value $name 
   '1234'='No'
   '1236'='Yes'
   '1345'='No'
   '1348'='Yes'
 ;

 value $location 
   '1234'='No'
   '1348'='Yes'
   '1236'='Yes'
   '1345'='No'
  ;

  value $matching
    '1A' ='Yes'
    '11A'='No'
    'B4' ='No'
    'B7' ='Yes'
  ;
run;

data want;
  set have;
  length result $3 ;
  if scan(NAME,-1,' ')='Number' then result='No';
  else if put(code,$name.)='Yes' then result='No';
  else if put(code,$location.)='Yes' then result='No';
  else result=put(location,$matching.) ;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    NAME             CODE    LOCATION    result

 1     First            1234      1A         Yes
 2     First Number     1346      11A        No
 3     Second Number    1235      B4         No
 4     Second           1345      B7         Yes
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: Since you already have the lookups in a WORKSHEET you can look at the CNTLIN= option of PROC FORMAT in the documentation to learn how to create the formats from the existing dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 16:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919156#M362051</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-06T16:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919158#M362053</link>
      <description>&lt;P&gt;for sample i have provided 4 vlookup values, but in reality i end up having approximately, 1200 vlookup values to check against 20 thousand records from main dataset.&lt;/P&gt;
&lt;P&gt;I think in this case i can't use format&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 17:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919158#M362053</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2024-03-06T17:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919162#M362055</link>
      <description>&lt;P&gt;1,200 values is not very many (its not 1977 any more).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Convert your "lookup" tables into datasets that can be used to create formats (or informats if you need) by PROC FORMAT with CNTLIN= option.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 17:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/919162#M362055</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-06T17:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Excel formula in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/954266#M372719</link>
      <description>&lt;P&gt;In SAS, you could use a combination of IF statements and PROC SQL for the lookups. Here's how you might structure it: data your_data;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set your_data;&lt;BR /&gt;if substr(a2, length(a2)-5, 6) = 'Number' then result = 'no';&lt;BR /&gt;else if (vlookup(b2, 'Names', 2) = 'yes') or (vlookup(b2, 'Location', 2) = 'yes') then result = 'no';&lt;BR /&gt;else result = vlookup(c2, 'Matching', 2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The vlookup function isn’t available directly in SAS, so you’ll likely need to use PROC SQL for those lookups or use an ARRAY structure if the lookup data is in a table format. I remember struggling with Excel to SAS translation, and what helped me was learning &lt;A href="https://sheetcast.com/turbotools/turbo-trace/show-formulas-in-excel" target="_self"&gt;how to view formulas in Excel&lt;/A&gt;. It allowed me to break down the logic clearly before attempting the conversion, which saved me tons of time.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-formula-in-SAS/m-p/954266#M372719</guid>
      <dc:creator>ghoststark</dc:creator>
      <dc:date>2024-12-20T12:09:00Z</dc:date>
    </item>
  </channel>
</rss>

