<?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: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298162#M10558</link>
    <description>&lt;P&gt;SAS Studio. I can get the XML mapping to work with a simpler, smaller file. And if I create an XML file from a SAS dataset and map that, it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if it were to do with the complexity of all the sub-files within the Health app export.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 22:03:01 GMT</pubDate>
    <dc:creator>LaurieF</dc:creator>
    <dc:date>2016-09-13T22:03:01Z</dc:date>
    <item>
      <title>Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296313#M10492</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4828i4EA4A0B16A50F0D1/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SGF2016steps.png" title="SGF2016steps.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you're Fitbit-less but have an iPhone, you can still &lt;A href="http://blogs.sas.com/content/iml/2014/08/22/activity-trackers.html" target="_self"&gt;follow-in-the-footsteps of Rick Wicklin&lt;/A&gt; and analyze every step you take. Just&amp;nbsp;&lt;/SPAN&gt;email yourself a .zip file of your&amp;nbsp;step data using the &lt;A href="http://www.idownloadblog.com/2015/06/10/how-to-export-import-health-data/" target="_self"&gt;iPhone Health App Export feature&lt;/A&gt;, uncompress the data, and read the export.xml file into SAS. Once it's there, you can of course have-at-it with all things SAS!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Step plot of steps tracked by iPhone Health App at SAS Global Forum 2016
  See idownloadblog.com/2015/06/10/how-to-export-import-health-data/ for how to get step data;

filename health '/folders/myfolders/export.xml';  * XML data provided by iPhone Health App;
filename map '/folders/myfolders/HealthData.map';
libname health xmlv2 xmlmap=map automap=replace;

proc sql;                                         * Grab step data from iPhone;
create table steps as
select input(substr(record_startDate,1,19),YMDDTTM19.) as startDT,
       input(substr(record_endDate,1,19),YMDDTTM19.) as endDT, record_value as steps
from health.Record(where=(record_type="HKQuantityTypeIdentifierStepCount"))
where record_startDate between '2016-04-18' and '2016-04-22 05' order by 1;

data totSteps(keep=time totsteps);                * Add cumulative steps for each day;
retain totsteps 0;                                
set steps;                                        * Reset cumulative steps if "new morning";
if intck('hour',lag1(enddt),startdt)&amp;gt;4 then totsteps=0; 
time=startdt;                                     * Time and total steps at beginning of period;
output;
totsteps+steps;                                   * Time and total steps at end of period;
time=enddt;
format time datetime19.;
output;
                                                  * Plot steps with a (what else?) step plot;
ods listing image_dpi=300 gpath='/folders/myfolders';
ods graphics on / reset antialias width=14in height=8.5in imagename="SGF2016steps";
proc sgplot data=totsteps;
title "Steps Taken at SGF 2016";
step x=time y=totsteps; 
yaxis label="STEPS (Source: iPhone Health App)" valuesformat=comma9. grid;
xaxis type=time grid valuesformat=datetime14. label="TIME (CDT)" fitpolicy=stagger
      values=("18APR2016:00:00:00"dt to "22APR2016:06:00:00"dt by "06:00:00"t) notimesplit;  
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Sep 2016 18:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296313#M10492</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-09-03T18:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296329#M10493</link>
      <description>&lt;P&gt;What I'm missing is how to get the map file used in the libname statement?&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 21:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296329#M10493</guid>
      <dc:creator>SteveBittner</dc:creator>
      <dc:date>2016-09-03T21:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296339#M10494</link>
      <description>&lt;P&gt;I had actually hand-coded a short MAP (see below), but then decided to try &lt;A href="http://support.sas.com/documentation/cdl/en/engxml/65362/HTML/default/viewer.htm#n0km8qcf0hv1kon1o7b345lkqk5k.htm" target="_self"&gt;the AUTOMAP option,&lt;/A&gt; which amazingly generates a MAP for you in the file whose name you specify, and went with that look-Ma-no-code approach instead!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;HAND-CODED MAP&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;lt;?xml version="1.0" ?&amp;gt;
&amp;lt;SXLEMAP version="1.2"&amp;gt;
&amp;lt;TABLE name="RECORDS"&amp;gt; 
&amp;lt;TABLE-PATH syntax="XPATH"&amp;gt;/HealthData/Record&amp;lt;/TABLE-PATH&amp;gt;
&amp;lt;COLUMN name="startDate"&amp;gt;&amp;lt;PATH&amp;gt;/HealthData/Record@startDate&amp;lt;/PATH&amp;gt;&amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;&amp;lt;DATATYPE&amp;gt;STRING&amp;lt;/DATATYPE&amp;gt;&amp;lt;LENGTH&amp;gt;40&amp;lt;/LENGTH&amp;gt;&amp;lt;/COLUMN&amp;gt;
&amp;lt;COLUMN name="endDate"&amp;gt;&amp;lt;PATH&amp;gt;/HealthData/Record@endDate&amp;lt;/PATH&amp;gt;&amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;&amp;lt;DATATYPE&amp;gt;STRING&amp;lt;/DATATYPE&amp;gt;&amp;lt;LENGTH&amp;gt;40&amp;lt;/LENGTH&amp;gt;&amp;lt;/COLUMN&amp;gt;
&amp;lt;COLUMN name="type"&amp;gt;&amp;lt;PATH&amp;gt;/HealthData/Record@type&amp;lt;/PATH&amp;gt;&amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;&amp;lt;DATATYPE&amp;gt;STRING&amp;lt;/DATATYPE&amp;gt;&amp;lt;LENGTH&amp;gt;100&amp;lt;/LENGTH&amp;gt;&amp;lt;/COLUMN&amp;gt;
&amp;lt;COLUMN name="unit"&amp;gt;&amp;lt;PATH&amp;gt;/HealthData/Record@unit&amp;lt;/PATH&amp;gt;&amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;&amp;lt;DATATYPE&amp;gt;STRING&amp;lt;/DATATYPE&amp;gt;&amp;lt;LENGTH&amp;gt;40&amp;lt;/LENGTH&amp;gt;&amp;lt;/COLUMN&amp;gt;
&amp;lt;COLUMN name="value"&amp;gt;&amp;lt;PATH&amp;gt;/HealthData/Record@value&amp;lt;/PATH&amp;gt;&amp;lt;TYPE&amp;gt;numeric&amp;lt;/TYPE&amp;gt;&amp;lt;DATATYPE&amp;gt;integer&amp;lt;/DATATYPE&amp;gt;&amp;lt;/COLUMN&amp;gt;
&amp;lt;/TABLE&amp;gt;
&amp;lt;/SXLEMAP&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 23:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296339#M10494</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-09-03T23:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296761#M10499</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Your suggetion to use automap=replace worked like a charm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;filename&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; xmldoc &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'/yourdisk/export.xml'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;filename&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; map &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'/yourdisk/healthdata.map'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; xmldoc &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;xmlv2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; automap=replace &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;xmlmap&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=map;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;datasets&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;lib&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=xmldoc;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 15:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/296761#M10499</guid>
      <dc:creator>SteveBittner</dc:creator>
      <dc:date>2016-09-06T15:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298152#M10556</link>
      <description>&lt;P&gt;Hmm - I can't get this to work. I know I have write access to the folder, because I can create datasets and flat files in it programmatically; but there's no other hint as to what the error message might be.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;57         filename health '/folders/myfolders/apple_health_export/export.xml';
 58         
 59         filename map '/folders/myfolders/apple_health_export/HealthData.map';
 60         
 61         libname health xmlv2 xmlmap=map automap=replace;
 ERROR: The creation of the XML Mapper file failed.
 ERROR: Error in the LIBNAME statement.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;scratches head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 21:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298152#M10556</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2016-09-13T21:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298161#M10557</link>
      <description>&lt;P&gt;I don'see the error. &amp;nbsp;What version of SAS are you using? &amp;nbsp;I'm using 9.4. I've since found an iPhone app the writes a .csv file from Health Data. &amp;nbsp;The app is called QS ACCESS and is free from Apple Store&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 22:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298161#M10557</guid>
      <dc:creator>SteveBittner</dc:creator>
      <dc:date>2016-09-13T22:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298162#M10558</link>
      <description>&lt;P&gt;SAS Studio. I can get the XML mapping to work with a simpler, smaller file. And if I create an XML file from a SAS dataset and map that, it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if it were to do with the complexity of all the sub-files within the Health app export.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 22:03:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298162#M10558</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2016-09-13T22:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Steppin' Out: Getting Step Data Out of the iPhone Health App and Into SAS</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298165#M10560</link>
      <description>&lt;P&gt;Very likely size is an issue. &amp;nbsp;You might try the map file coded by TC above. It may skip most of the complexity&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 22:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Steppin-Out-Getting-Step-Data-Out-of-the-iPhone-Health-App-and/m-p/298165#M10560</guid>
      <dc:creator>SteveBittner</dc:creator>
      <dc:date>2016-09-13T22:33:52Z</dc:date>
    </item>
  </channel>
</rss>

