Automatic Filtering of User Data
In some situations data might be user sensitive and locked down such that only the owner can view it. There is a quick method of automatically setting this up by using Data Step Views and capturing the user logging details.
By creating a view using PROC SQL we can pre-filter the data so that only data related to the owner (userid) present in the table is matched against the user logging details. The SQL procedure contains a USER literal word to achieve this, but otherwise using the &SYSUSERID macro variable can also produce the required results.
data sales; set sashelp.shoes; length userid $20; if region='Africa' then userid='John Smith'; else if region='Asia' then userid='Elena.Muriel'; else if region='Canada' then userid=''; else if region='Pacific' then userid=''; run;
create view mysales as
select * from sales
Automatic filtering will occur when accessing the view created.