DATA Step, Macro, Functions and more

Saving and displaying binary data field

Regular Contributor
Posts: 246

Saving and displaying binary data field


Is it possible to save a thumbnail in a SAS dataset as binary data?

Is it then possible to show this thumbnail in a SAS Stored Process?

I find not many information... any help here?



Super User
Posts: 5,888

Saving and displaying binary data field

There is no data type (such as BLOB) in SAS that handle binary object as is. Maybe you can accomplish this with some tweaking.

But why do you want to store this in a SAS table? Perhaps you can solve this by using an webDAV or other alternatives available with the web application server?

Data never sleeps
Posts: 9,371

Saving and displaying binary data field


  In addition to LinusH's suggestion, while you cannot save the thumbnail, itself, in a SAS dataset, you could create a character variable that contained the URL to, or the server location of, the image file. For example, let's say that you wanted to display a picture of an employee in a report, next to their name/phone number. Assuming that

1) you had the picture files stored on a server accessible to the stored process server or workspace server in some organized fashion:  employee 111 pix is stored as 111.jpg, employee 222 pix is stored as 222.jpg, etc


2) you were returning the stored process results to a client application (such as the Information Delivery Portal or the Stored Process Web App) that would render the images inside stored process results


3) you could use the ODS style attribute PREIMAGE or POSTIMAGE to either point to a pre-built file location in a character variable or you could assemble the PREIMAGE location from the employee id


your client application had server/file accessibility and is able to render the image style attributes, then the image would be displayed in your report/results.

In this case, you would not actually "show the thumbnail in a SAS Stored Process", but would cause your stored process results to contain a pointer to the image file location using a style attribute, so that, when the results were rendered in the client application, the image was displayed inside the stored process results. This may be something to work on with Tech Support -- client application ability to render the image style attributes will be critical to making this work.


Regular Contributor
Posts: 246

Saving and displaying binary data field

Posted in reply to Cynthia_sas

Hi Cynthia,

I will explain a bit more our application.

User has a picture, saves it via .NET application. The .NET application stores the picture at secret location. .NET passes metadata and a Reference ID to a SAS Stored process which saves the data in a table.

When the User wants to see his pictures again he clicks on a link and the .NET application returns the image.

I am able to do the following:

data _null_;

file _webout;

put "<img src= width=150>";


But when I want to build a search functionallity and it returns 100 pictures, it is going to take a while to load all big JPEG,BMP,... so we want thumbnails.

The goal is to also pass the binary information to save in the metadata table. And later in the HTML report to show the thumbnails. If thumbnail is clicked then show the real big picture (so that i already have).

I don't find any information about this topic, I also opened a call to Tech Support.

Trusted Advisor
Posts: 1,318

Saving and displaying binary data field

There are plenty of ways to accomplish what it appears that you are trying to do.  There are a few things to consider that I will say quickly:

You will need a mid-tier application to perform the thumbnail creations, there are lots of options for this, like imagemagick which is a fairly common application for this type of work:

You can then follow a similar excersie to what Cynthia posted except go one more display the newly created thumbnail image as a link to the url for the associated larger image.

As far as storing the binary information is concerned you will most likely experience problems attempting to store this in a SAS dataset considering it is highly likey that a large image file, espeically in binary format far exceeds the maximum length to store in a single column as least.

Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation