<?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 How to store multiple observations data into single observation one below one. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622164#M19722</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Senario is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have stored SAS codes into SAS DATASET under a single column and every SAS code is stored under separate observation wrt the obs line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The requirement is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If %macro or %mend that should be in separate line&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;remain codes exist within macro loop&lt;/P&gt;&lt;P&gt;that should be comes or store it into a single observation one below one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same end result need to export to the excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached excel for the better understanding the requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: So many macros are exist in single column with other SAS codes like data step process step process SQL steps within macro loop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't consider obs column just for reference I have added to understand scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 11:51:14 GMT</pubDate>
    <dc:creator>Veeresh</dc:creator>
    <dc:date>2020-02-04T11:51:14Z</dc:date>
    <item>
      <title>How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622164#M19722</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Senario is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have stored SAS codes into SAS DATASET under a single column and every SAS code is stored under separate observation wrt the obs line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The requirement is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If %macro or %mend that should be in separate line&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;remain codes exist within macro loop&lt;/P&gt;&lt;P&gt;that should be comes or store it into a single observation one below one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same end result need to export to the excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached excel for the better understanding the requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: So many macros are exist in single column with other SAS codes like data step process step process SQL steps within macro loop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't consider obs column just for reference I have added to understand scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622164#M19722</guid>
      <dc:creator>Veeresh</dc:creator>
      <dc:date>2020-02-04T11:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622167#M19723</link>
      <description>&lt;P&gt;I see no data in your xlsx, only code.&lt;/P&gt;
&lt;P&gt;Datasets are for data, NOT for code.&lt;/P&gt;
&lt;P&gt;If you want to store codes for later reuse, you store them as text files (usually with extension .sas) and %include them where needed.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 12:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622167#M19723</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-04T12:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622175#M19726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310458"&gt;@Veeresh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an attempt to do this.&lt;/P&gt;
&lt;P&gt;However, it is not a good practice to store SAS code in dataset. Don't you have any other possibility?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input SAS_CODES $80.;
	datalines4;
%Macro student(x=,y=);
data &amp;amp;x;
set student_data;
run;
proc sort data=&amp;amp;x; out=&amp;amp;y;
by age;
run;
%mend student;
%student(x=student_age, y=std_age_sorted)
%macro employee(ID=, Location);
data emp;
set emp_hist;
where  Emp_id="&amp;amp;id" and location="&amp;amp;location";
run;
proc sort data=emp out=emp_loc;
run;
%mend employee;
%employee(ID=101_FS, Location=China);
;;;;

data have_temp;
	set have;
	length SAS_CODES2 $ 1000;
	
	M_start = find(SAS_CODES, %nrstr('%Macro'),'i')&amp;gt;0;
	M_end = find(SAS_CODES, %nrstr('%Mend'),'i')&amp;gt;0;
	
	retain M_flag 0;
	if M_start=1 then M_flag=1;
	if M_end=1 then M_flag=0;

	M_flag_F = M_flag;
	if M_start=1 then M_flag_F=0;
	
	retain SAS_CODES2;
	if M_flag_F=1 then SAS_CODES2 = catx('',SAS_CODES2,SAS_CODES);
	
	SAS_CODESF = SAS_CODES2;
	if M_flag_F=0 then SAS_CODESF=SAS_CODES;
	
	drop SAS_CODES SAS_CODES2;
run;

data want;
	set have_temp;
	by M_flag_F notsorted;
	if M_flag_F=0 or (M_flag_F=1 and last.M_flag_F=1) then output;
	drop M:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622175#M19726</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-04T13:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622176#M19727</link>
      <description>&lt;P&gt;Yes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;sas codes stored in variable as a data in sas dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622176#M19727</guid>
      <dc:creator>Veeresh</dc:creator>
      <dc:date>2020-02-04T13:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622177#M19728</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310458"&gt;@Veeresh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sas codes stored in variable as a data in sas dataset.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;WHAT FOR??&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;FONT size="2"&gt;In 20+ years of working with SAS, I've never done that, never had the need for it, never saw it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622177#M19728</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-04T13:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622182#M19729</link>
      <description>&lt;P&gt;Its a requirement from HR analytics and business analytics department.&lt;/P&gt;&lt;P&gt;Exporting SAS end results to the excel sheet as i mentioned.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further i requested for usage of this output&amp;nbsp; got reply&amp;nbsp; like departmental expertise analysts can utilize these coding examples to showcase business stockholders and analysts.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622182#M19729</guid>
      <dc:creator>Veeresh</dc:creator>
      <dc:date>2020-02-04T13:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622184#M19730</link>
      <description>&lt;P&gt;Thanks for your valuable input !&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is not related to saving SAS codes concepts , It other departmental scenario basis requirement&amp;nbsp;from HR analytics and business analytics department.&lt;/P&gt;&lt;P&gt;Exporting SAS end results to the excel sheet as i mentioned.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 13:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622184#M19730</guid>
      <dc:creator>Veeresh</dc:creator>
      <dc:date>2020-02-04T13:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622189#M19732</link>
      <description>&lt;P&gt;Are you just asking to insert extra blank lines before and after macro definitions?&lt;/P&gt;
&lt;P&gt;Let's assume your dataset is named HAVE and the variable with the SAS code is named LINE.&lt;/P&gt;
&lt;P&gt;Here is a way to write it into an Excel file name example.xlsx.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods listing close;
ods excel file= 'example.xlsx';
data _null_;
  set codes;
  file print;
  if findw(line,'%macro','i') then put;
  len=length(line);
  put line $varying200. len;
  if findw(line,'%mend','i') then put;
run;
ods excel close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Feb 2020 14:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622189#M19732</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-04T14:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622191#M19733</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310458"&gt;@Veeresh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Its a requirement from HR analytics and business analytics department.&lt;/P&gt;
&lt;P&gt;Exporting SAS end results to the excel sheet as i mentioned.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further i requested for usage of this output&amp;nbsp; got reply&amp;nbsp; like departmental expertise analysts can utilize these coding examples to showcase business stockholders and analysts.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Oh, the ones that can't even have a sh*t without storing it in Excel first. And make a PowerPoint presentation out of it.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 14:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622191#M19733</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-04T14:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to store multiple observations data into single observation one below one.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622218#M19736</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310458"&gt;@Veeresh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Senario is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have stored SAS codes into SAS DATASET under a single column and every SAS code is stored under separate observation wrt the obs line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The requirement is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If %macro or %mend that should be in separate line&lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;remain codes exist within macro loop&lt;/P&gt;
&lt;P&gt;that should be comes or store it into a single observation one below one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same end result need to export to the excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached excel for the better understanding the requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: So many macros are exist in single column with other SAS codes like data step process step process SQL steps within macro loop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't consider obs column just for reference I have added to understand scenario.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your XLSX file shows "current output".&lt;/P&gt;
&lt;P&gt;Then you should provide 1) an actual example of the dataset and 2) the current code creating the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:44:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-store-multiple-observations-data-into-single-observation/m-p/622218#M19736</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-04T15:44:05Z</dc:date>
    </item>
  </channel>
</rss>

