BookmarkSubscribeRSS Feed
OrourkeBow
Obsidian | Level 7

Hi, 

 

I have existing code from older work from a previous user. This code is set up to path to files on my computer. These are in .AWC. format, specific to the accelerometer we use - the Actical. 

 

The main issue is that SAS on demand or SAS viya for learners will not recognize my data for some reason. I can open the data as a test and see the variables and data, so it will not collect the values for some reason. The data is 2 columns, time and steps. This data has been analyzed properly before by a previous researcher, but we do not have contact with them. Plus, this was a much older version of SAS, and I cannot open our .egp Flow process on there, as it seems to not be capable with 4.3. 

 

If you see the code, I have all my data in the "DATA" folder, ending with AWC. And the participants are coded as the following: PLA001T1 (withT1 to T3 possible), hence labelled as 8 for length. 

 

I am also trying to export that data into xlsx (Excel), and this will not work. For clarity, I am using a Mac, but it should be fine as I am using the browser versions. 

Although no data shows up in the spreadsheets, the code seems to be ok overall, but I also get this error at the end. This error comes up twice. From my searching, this is due to it making an error trying to export into excel. 

 

ERROR: Server Name is invalid or missing.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

The entire code is attached for reference. 

 

I am unsure if this makes any sense, but any help would be appreciated. I am a beginner, using existing code, as I was volunTOLD to do this by my supervisor lol. 

 

Thank you in advance. 

31 REPLIES 31
quickbluefish
Barite | Level 11

You need to specify a DBMS (database management system) in each of the PROC EXPORT steps in your code:

* for example - to export a dataset called STUFF to the outfile "&outxls": ;

proc export data=stuff dbms=xls REPLACE
    outfile="&outxls";
sheet="&sheetname";
run;

REPLACE is optional - however, if you omit it and the file already exists, it's going to fail -- replace causes it to overwrite the existing file.

 

SHEET is also optional (note it's a separate statement -- has its own semicolon) - you can write multiple sheets to the same XLS / XLSX file by running proc export multiple times with different sheet names.

 

I'm not honestly sure that XLS is still valid.  If this is still failing, I would highly recommend trying XLSX (change file names too) instead -- DBMS=XLSX
*

OrourkeBow
Obsidian | Level 7
Thanks for the reply. Tbh, I do not understand. Again I am new. From what I got when troubleshooting via AI, the dmbs were used to load existing Excel files. That is the only time I have seen when searching. But I low-key do not understand the logic of your code (as I do not know it at all, basically). My data is in .awc. File format specific to my data. I swapped the xls to xlsx but was unsure if the oath_xls also needed to be changed. All of the participant data is uploaded into the data folder, and can be viewed as a text file, but not data appears in the analysis or processing. So that is the biggest issue, but after that is to get the data into excel for actual use. Again the code should work, a least it did previously, as it seems if the files were on my computer I could just "plug and play" with changing the path. Is that the correct interpretation? Or is this just outdated
quickbluefish
Barite | Level 11
If you look search for "PROC EXPORT" in your code, you should find a few places where this step occurs. From what I saw, those steps are missing the "DBMS=XLS" portion (as shown in my example above). You don't need to copy / understand the rest of what I wrote. Just add the DBMS=XLS part. That should fix the error you're currently getting. Unclear if there will be other errors after that.
OrourkeBow
Obsidian | Level 7
Thanks.
I will try that. Unsure if that help with getting my data to actually appear lol, but that is its own can of worms.
sofor the code below:
proc export data = perday outfile = "&xls_path.";
run;
I add "DBMS=XLS" before run?

Also, would I have to make sure the file name has .xls, not .xlsx?
quickbluefish
Barite | Level 11

It needs to come before the first semicolon -- so like this:

proc export data = perday DBMS=XLS outfile = "&xls_path.";
run;

&XLS_PATH is a macro variable, meaning, when SAS runs this code, it will "interpret" this variable and replace it with the underlying text.  

So somewhere in your code, you have a statement like this:

%let xlspath=/home/data/accelldata.xls;

 

You are storing the path and filename into a macro variable called xlspath.  When you put an & in front of that (&xlspath) in your code, SAS will replace it with your path/filename (simply because that's the text you set it equal to).

 

Again, I don't know what other problems might be in your code.  I'm not sure what you mean by you can't find your data.  Do you mean the source data or the data you're trying to create with the program?  You've looked through all the folders in SAS OnDemand?

OrourkeBow
Obsidian | Level 7

Screenshot 2025-01-13 at 10.20.41 PM.png

So your adjustment worked in regard to creating the Excel export, which is great! Thanks! No more server error. But it just further highlights the issue with it reading my data. None of the data is being "loaded" in. This code was used in the same file format before, but the path was direct on the computer; the only difference is that it is being uploaded to the on-demand system. So something must be up with my path, directory or the files themselves. I should also be able to bulk run the participants, so idk what is happening. I cannot get a trial version to download to my computer as I have a mac. Even if I use another Pc, support told me I cannot get a trial if I am not a business. 

OrourkeBow
Obsidian | Level 7
Also, you can see the code creates all the proper environment and columns etc, its just the data is not being picked up somehow
OrourkeBow
Obsidian | Level 7

Here is my directory. 

 

A library was created for "DATA"

 

Screenshot 2025-01-13 at 10.28.11 PM.png

quickbluefish
Barite | Level 11

OK, here's what I suggest.  With your mouse, highlight the entire portion of the program from the very top to just above (not including) the green 'comment' lines shown in the screenshot below.  With that highlighted, hit the run button.  Once it's done, go to the tab that shows the log.  Tell us what you see.  What's happening in that section is that it's trying to read all your .awc files (you will see them defined in the line that starts with "filename rawdata").  Below that is the first "DATA" step - it's pretty complicated looking, but basically it's reading in the .awc files that were defined with the handle "rawdata" and determining what looks like valid data and what doesn't.  The valid stuff (if any) is going into a dataset that's for some reason just called "c".  The rest are getting dumped into two other files.  What you need to do is look at the log towards the bottom that should be reporting the results of this process.  If it's successfully reading the 'rawdata' files, (i.e., no errors), it should tell you how many rows are getting output to each of the 3 datasets it's trying to create.  Tell us what you see in this portion of the log.

 

quickbluefish_0-1736859133299.png

 

OrourkeBow
Obsidian | Level 7

Once again, thank you so much for the help. Since I find this all a bit confusing, I have attached my entire log output for simplicity (on my end). Sorry if this is too much to ask and you want me to pull something more specific out. 

 

thanks

quickbluefish
Barite | Level 11

Really hard to say what's going on - from the log, it looks like it loaded one of the .awc files and read 12 records from it, but none of the 3 output datasets have any records in them.  The output dataset called 'c' should have all the records but doesn't. I don't know why that would be the case.  Maybe someone here who understands more about reading unusual data could help.  I would recommend you reach out to these people (assuming that's not where you already work) for help:

https://impactslab.com/wp-content/uploads/2021/02/UserManual_BoudreauBelanger-V1-3-2.pdf

OrourkeBow
Obsidian | Level 7
Aha. The authors of this are the original coders, so we are in contact with them. But gain, since this was 2014, they have far moved on. This is accelerometer is not used much anymore, because of this code nightmare lol. We now use newer ones that we can use R packages, and the software gives excel output so life is much easier. But i have been given the awesome tasks of going back and scanning data for a study so this is where the issues coming from
Tom
Super User Tom
Super User

I think the program was written by someone that only used PC SAS.

It has comments in there that using filename wildcard of *.awc will match files that end with .awcm.  Which is true on Windows, but not on UNIX.

It also is parsing the filename using only \ and period as delimiters.  But on UNIX the filename will use / as the delimiter between directory levels.

OrourkeBow
Obsidian | Level 7
Is this something that can be changed?
If I were to just run this on a Windows PC would it work based on the logic? Could I control F or find these spots easily? Would the awcm thing matter when it's on the cloud server? The code was originally made for old SAS version on some old PC in like 2014 lmao. Is this fixable? Or should i look to find a PC with SAS on it, but then I would need to physically have the files there vs just using the on demand, but on a PC?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 31 replies
  • 18548 views
  • 3 likes
  • 3 in conversation