<?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 PROC Groovy Submit Command failed in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308094#M61152</link>
    <description>&lt;P&gt;Hi all!&amp;nbsp; Nothing better than trying to debug SAS Code on a Saturday afternoon &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just starting to dig into Twitter analytics with PROC Groovy, using a blog post that I found by Falko Schulz (&lt;A href="http://blogs.sas.com/content/sascom/2013/12/12/how-to-import-twitter-tweets-in-sas-data-step-using-oauth-2-authentication-style/" target="_self"&gt;here&lt;/A&gt;) and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19924"&gt;@FriedEgg﻿&lt;/a&gt;'s posts through the community, but I'm stuck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code that is giving me the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc groovy classpath="C:/bookdata/TwitterAnalysis/groovy-all-2.3.4.jar";
add classpath="C:/bookdata/TwitterAnalysis/opencsv-3.8.jar";
   submit "&amp;amp;JSON_TWEET_FILE." "&amp;amp;CSV_TWEET_FILE."; 
      import groovy.json.*;
      import au.com.bytecode.opencsv.CSVWriter;
 
      def input = new File(args[0]).text;
      def output = new JsonSlurper().parseText(input);
      def csvoutput = new FileWriter(args[1]);
 
      CSVWriter writer = new CSVWriter(csvoutput);
 
      String[] header = new String[15];
      header[0] = "id";
      header[1] = "text";
      header[2] = "truncated";
      header[3] = "created_at";
      header[4] = "user.id";
      header[5] = "user.name";
      header[6] = "user.screen_name";
      header[7] = "user.location";
      header[8] = "user.description";
      header[9] = "user.url";
      header[10] = "user.followers_count";
      header[11] = "user.friends_count";
      header[12] = "user.listed_count";
      header[13] = "retweet_count";
      header[14] = "favorite_count";
      writer.writeNext(header);
 
      output.statuses.each {
         String[] content = new String[15];
         content[0] = it.id.toString();
         content[1] = it.text.toString();
         content[2] = it.truncated.toString();
         content[3] = it.created_at.toString();
         content[4] = it.user.id.toString();
         content[5] = it.user.name.toString();
         content[6] = it.user.screen_name.toString();
         content[7] = it.user.location.toString();
         content[8] = it.user.description.toString();
         content[9] = it.user.url.toString();
         content[10] = it.user.followers_count.toString();
         content[11] = it.user.friends_count.toString();
         content[12] = it.user.listed_count.toString();
         content[13] = it.retweet_count.toString();
         content[14] = it.favorite_count.toString();
 
         writer.writeNext(content)
      }         
 
      writer.close();
 
    endsubmit; 
 quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Based on the troubleshooting tips from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19924"&gt;@FriedEgg﻿&lt;/a&gt;&amp;nbsp;and others, I was able to figure out for example i needed to change \ to / in my file locations.&amp;nbsp; The orginal article also had the Classpaths for the two JAR files in the same classpath statement, but I am still getting the same error:&amp;nbsp; Nothing else in the code was changed from the orignal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: The SUBMIT command failed.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script44.groovy: 2: unable to resolve class au.com.bytecode.opencsv.CSVWriter
 @ line 2, column 7.
         import au.com.bytecode.opencsv.CSVWriter;
         ^

1 error

     at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
     at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:860)
     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
     at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:497)
     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:474)
     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
     at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:739)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:766)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:757)
3303   quit;&lt;/PRE&gt;
&lt;P&gt;So from what I gather, it's something to do with the opencsv JAR file, but I've tried the newest version (3.8) the one in the orginal article (2.3) as well as the most recent groovy-all JAR (2.3.4) and again the one refered to in the blog (2.2.1).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other PROC Groovy in the code seems to run fine, but it is doing something with the JSON file rather than with the CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any thoughts?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much for your time!&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Sat, 29 Oct 2016 19:54:49 GMT</pubDate>
    <dc:creator>DarthPathos</dc:creator>
    <dc:date>2016-10-29T19:54:49Z</dc:date>
    <item>
      <title>PROC Groovy Submit Command failed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308094#M61152</link>
      <description>&lt;P&gt;Hi all!&amp;nbsp; Nothing better than trying to debug SAS Code on a Saturday afternoon &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just starting to dig into Twitter analytics with PROC Groovy, using a blog post that I found by Falko Schulz (&lt;A href="http://blogs.sas.com/content/sascom/2013/12/12/how-to-import-twitter-tweets-in-sas-data-step-using-oauth-2-authentication-style/" target="_self"&gt;here&lt;/A&gt;) and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19924"&gt;@FriedEgg﻿&lt;/a&gt;'s posts through the community, but I'm stuck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code that is giving me the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc groovy classpath="C:/bookdata/TwitterAnalysis/groovy-all-2.3.4.jar";
add classpath="C:/bookdata/TwitterAnalysis/opencsv-3.8.jar";
   submit "&amp;amp;JSON_TWEET_FILE." "&amp;amp;CSV_TWEET_FILE."; 
      import groovy.json.*;
      import au.com.bytecode.opencsv.CSVWriter;
 
      def input = new File(args[0]).text;
      def output = new JsonSlurper().parseText(input);
      def csvoutput = new FileWriter(args[1]);
 
      CSVWriter writer = new CSVWriter(csvoutput);
 
      String[] header = new String[15];
      header[0] = "id";
      header[1] = "text";
      header[2] = "truncated";
      header[3] = "created_at";
      header[4] = "user.id";
      header[5] = "user.name";
      header[6] = "user.screen_name";
      header[7] = "user.location";
      header[8] = "user.description";
      header[9] = "user.url";
      header[10] = "user.followers_count";
      header[11] = "user.friends_count";
      header[12] = "user.listed_count";
      header[13] = "retweet_count";
      header[14] = "favorite_count";
      writer.writeNext(header);
 
      output.statuses.each {
         String[] content = new String[15];
         content[0] = it.id.toString();
         content[1] = it.text.toString();
         content[2] = it.truncated.toString();
         content[3] = it.created_at.toString();
         content[4] = it.user.id.toString();
         content[5] = it.user.name.toString();
         content[6] = it.user.screen_name.toString();
         content[7] = it.user.location.toString();
         content[8] = it.user.description.toString();
         content[9] = it.user.url.toString();
         content[10] = it.user.followers_count.toString();
         content[11] = it.user.friends_count.toString();
         content[12] = it.user.listed_count.toString();
         content[13] = it.retweet_count.toString();
         content[14] = it.favorite_count.toString();
 
         writer.writeNext(content)
      }         
 
      writer.close();
 
    endsubmit; 
 quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Based on the troubleshooting tips from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19924"&gt;@FriedEgg﻿&lt;/a&gt;&amp;nbsp;and others, I was able to figure out for example i needed to change \ to / in my file locations.&amp;nbsp; The orginal article also had the Classpaths for the two JAR files in the same classpath statement, but I am still getting the same error:&amp;nbsp; Nothing else in the code was changed from the orignal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: The SUBMIT command failed.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script44.groovy: 2: unable to resolve class au.com.bytecode.opencsv.CSVWriter
 @ line 2, column 7.
         import au.com.bytecode.opencsv.CSVWriter;
         ^

1 error

     at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
     at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:860)
     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
     at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:497)
     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:474)
     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
     at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:739)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:766)
     at groovy.lang.GroovyShell.parse(GroovyShell.java:757)
3303   quit;&lt;/PRE&gt;
&lt;P&gt;So from what I gather, it's something to do with the opencsv JAR file, but I've tried the newest version (3.8) the one in the orginal article (2.3) as well as the most recent groovy-all JAR (2.3.4) and again the one refered to in the blog (2.2.1).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other PROC Groovy in the code seems to run fine, but it is doing something with the JSON file rather than with the CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any thoughts?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much for your time!&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2016 19:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308094#M61152</guid>
      <dc:creator>DarthPathos</dc:creator>
      <dc:date>2016-10-29T19:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Groovy Submit Command failed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308113#M61154</link>
      <description>&lt;P&gt;The most likely answer is simply that you are not using the correct name for the class in your import statement.&amp;nbsp; Versions are important and you are using version 3.8 of opencsv, whereas the code you copied was using version 2.3.&amp;nbsp; During the time between these versions the package name was changed making the class name you are looking for in the version 3.8 Jar file "com.opencsv.CSVWriter"&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2016 03:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308113#M61154</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2016-10-30T03:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC Groovy Submit Command failed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308132#M61155</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19924"&gt;@FriedEgg﻿&lt;/a&gt;! Thanks for the reply. &amp;nbsp; I've tried groovy-all-2.2.1 and 2.3.8, and opencsv-2.3 and 3.8 in all 4&amp;nbsp;combinations and get the same error. &amp;nbsp;I am off travelling tomorrow and not back until Saturday so probably won't have a chance to look at this again until next weekend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much for your help - have a great day!&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2016 10:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-Groovy-Submit-Command-failed/m-p/308132#M61155</guid>
      <dc:creator>DarthPathos</dc:creator>
      <dc:date>2016-10-30T10:18:52Z</dc:date>
    </item>
  </channel>
</rss>

