Dear All,
Greetings!
I have a dataset from which I need to copy all the values in a column in an excel sheet. My question was - is there any 'direct' way of copying all the values from a column in SAS viewtable?
Currently, the method I followed was - opening the dataset in excel and then copying the contents from that excel and then pasting the values in another excel. But I wanted to know if there is any direct way. Thanks in advance!
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
@DrAbhijeetSafai wrote:
%put %sysfunc(getoption(work));
The statement is giving me the current location of the work folder, which is in SAS Temporary Files folder on C drive.
I am able to understand that this path needs to be changed to other path.
There is no need to change anything. In the SAS Universal Viewer just left-click on the File menu, then "Open" → "SAS Data Set...". This will open the usual "Open" dialog that is common to many programs under Windows. There you navigate to the folder where the dataset of interest resides -- be it the SAS Temporary Files folder on your C drive or any other location that is accessible from your Windows Explorer. Finally, select the dataset and click the "Open" button (or double-click the file).
It's really analogous to opening a text file with Notepad or an .xlsx file with Excel or a .sas file with SAS, ...
Similarly, you can associate .sas7bdat (and possibly .sas, .xpt, .lst, ...) files with the SAS Universal Viewer so that you can double-click on a SAS dataset (SAS program, transport file, SAS output, ...) in Windows Explorer and it will be opened with the Universal Viewer by default, which is often easier than going through the File menu if you already see the file of interest in a folder.
Hello @DrAbhijeetSafai,
I don't think this is possible with VIEWTABLE, but it should work with the SAS Universal Viewer, which I suggested to you earlier this year. (Actually, I have only tested it by copying to Notepad because I don't have Excel on my workstation. But copying from Notepad's .txt file to Excel on another PC worked, so it should work directly as well.)
Hi @FreelanceReinh , thanks for the comment.
The problem is (as I have mentioned in the comment to your previous comment too) that the files are in work folder and are not permanently saved. For using SAS Universal viewer, I will need to save permanently (not in work library) them somewhere as I understand.
Kindly guide if I am missing something.
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
As I explained in that previous thread, datasets in the WORK library can be opened with the Universal Viewer like datasets in any other library. You can even open datasets that are not assigned to a library (with a LIBNAME statement) at all. The Universal Viewer works with .sas7bdat files wherever they are stored and it then calls the folder where the dataset resides a "library" (see Library tab in the software) and lists all .sas7bdat files it finds there.
Thank you for your patient response @FreelanceReinh . I tried using what you had shared there.
%put %sysfunc(getoption(work));
The statement is giving me the current location of the work folder, which is in SAS Temporary Files folder on C drive.
I am able to understand that this path needs to be changed to other path. And files can be accessed from that folder where I can use SAS Universal Viewer.
But I am not able to understand how to set this path. I tried following things:
libname sandbox "Path of the folder";
options work = sandbox;
But that is not working.
Thanks in advance.
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
@DrAbhijeetSafai wrote:
%put %sysfunc(getoption(work));
The statement is giving me the current location of the work folder, which is in SAS Temporary Files folder on C drive.
I am able to understand that this path needs to be changed to other path.
There is no need to change anything. In the SAS Universal Viewer just left-click on the File menu, then "Open" → "SAS Data Set...". This will open the usual "Open" dialog that is common to many programs under Windows. There you navigate to the folder where the dataset of interest resides -- be it the SAS Temporary Files folder on your C drive or any other location that is accessible from your Windows Explorer. Finally, select the dataset and click the "Open" button (or double-click the file).
It's really analogous to opening a text file with Notepad or an .xlsx file with Excel or a .sas file with SAS, ...
Similarly, you can associate .sas7bdat (and possibly .sas, .xpt, .lst, ...) files with the SAS Universal Viewer so that you can double-click on a SAS dataset (SAS program, transport file, SAS output, ...) in Windows Explorer and it will be opened with the Universal Viewer by default, which is often easier than going through the File menu if you already see the file of interest in a folder.
Thank you @FreelanceReinh !
That really helped!
- Dr. Abhijeet Safai
Just a comment.
Your very limited description of what appears to part of a process indicates someone is still thinking like a spreadsheet user and not a SAS user.
In my current position I inherited a bunch of stuff that was done like that. It took a while, one report at a time, to create the SAS data sets from the Excel files that were "pasted into" and creating proper reports.
Of course the fun parts were correcting all the randomly inserted formula cells that had made the previous process have significant errors because no one paid attention to the actual results to see that they were inconsistent. "But that's the way the report always was done" isn't really much of a reason to include such.
@ballardw wrote:
.....process indicates someone is still thinking like a spreadsheet user and not a SAS user.
🤣 I agree absolutely! This is similar analogy to two wheeler driving and four wheeler driving! In India, people generally drive two wheelers. So I also used to drive it. But when I purchased a car, I shifted my driving skills from two wheeler to four wheeler. But in the process, for many months or years I was driving car as if I am driving a two wheeler. In head I was still driving two wheeler even though I had car in my hand. I mean I was still trying to driving from the left side of the road, which is a typical style and a requirement for two wheeler driving. I was not picking up speed and so on. Many traits in my driving skills were as if I am driving a two wheeler !
You have brought attention to a very important point regarding SAS and that is - SAS changes the way in which we think about data! It changes our thoughts and also process of thinking!
Thanks for sharing your observation which is so correct!
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
@DrAbhijeetSafai wrote:
You have brought attention to a very important point regarding SAS and that is - SAS changes the way in which we think about data! It changes our thoughts and also process of thinking!
Thanks for sharing your observation which is so correct!
Thanking you,
Yours sincerely,
- Dr. Abhijeet Safai
Actually Dr Safai, using Excel made me change, when I had to. I had used SAS for 10 years before I saw my first Excel file.
And was amazed at the amount of repetitive click/select/click some menu operation/ etc that users seem to accept. One of my first work related projects using Excel involved creating a bunch of similar graphs. I kept looking for some way to emulate a SAS BY statement as that was the model: do the same thing for each group in the data. Doing things like getting all of the axis appearance the same as a separate step after creating the graph was just annoying considering the SAS/Graph I had used prior I knew I could set identical axis (and symbol /line appearance) without having to play with each created graph.
@ballardw wrote:
I had used SAS for 10 years before I saw my first Excel file.
Wow! Thanks for sharing!
- Dr. Abhijeet Safai
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.