GithubHelp home page GithubHelp logo

sasmarkdown's People

Contributors

hemken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sasmarkdown's Issues

Object out.log not found

It seems I've successfully installed the package, but keep getting an error when testing. I've searched online but have not found a solution that works.
Here is my code when testing:

knitr::opts_chunk$set(echo = TRUE)
library(SASmarkdown)
package �SASmarkdown� was built under R version 4.0.5sas, saslog, sashtml, and sashtmllog engines
are now ready to use.

proc means data=sashelp.class (keep = age);
run ;

Here is resulting error:
Error in knitrEngine(mergedOptions) : object 'out.log' not found

SASmarkdown fails when there is a syntax error in SAS code

Hello,

SASmarkdown package is OK when SAS code is OK:

knitr::opts_chunk$set(echo = TRUE)
require(SASmarkdown)
## Loading required package: SASmarkdown

## sas, saslog, sashtml, and sashtmllog engines

##    are now ready to use.
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 75"
knitr::opts_chunk$set(engine='sas', engine.path=saspath,
                      engine.opts=sasopts, comment="")
proc means data=sashelp.class;
run;
                              Procédure MEANS

 Variable    N        Moyenne     Ecart-type        Minimum        Maximum
 -------------------------------------------------------------------------
 Age        19     13.3157895      1.4926722     11.0000000     16.0000000
 Height     19     62.3368421      5.1270752     51.3000000     72.0000000
 Weight     19    100.0263158     22.7739335     50.5000000    150.0000000
 -------------------------------------------------------------------------

but fails when there is a syntax error in SAS :

proc means data sashelp.class;
run;

sasmarkdown_error


It would be usefull to get the SAS log as with SASKernel:

proc means data sashelp.class;
run;
SAS Connection established. Subprocess id is 6648

6                                                          Le Système SAS                         15:53 Thursday, September 13, 2018

39 ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg style=HTMLBlue;
39 ! ods graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
40
41 proc means data sashelp.class;
_____________
73
ERROR 73-322: Un(e) = est attendu(e).
42 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

43
44 ods html5 (id=saspy_internal) close;ods listing;
45

Thanks,

SASmarkdown fails to use collectcode

Hi, I've successfully installed the package, but keep getting an error when using collectcode (R version 4.1.0 knitr version 1.33). I've searched online but have not found a solution that works.
Here is my code when testing:
`

library(SASmarkdown)
saspath <- "D:/SAS 9.4/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -linesize 75"
knitr::opts_chunk$set(engine="sas", engine.path=saspath, 
        engine.opts=sasopts, comment=NA)

knitr::opts_chunk$get()$engine
knitr::opts_chunk$get()$engine.path
knitr::opts_chunk$get()$engine.opts`
#{sas DATAstep, collectcode=TRUE} 
data class;
  set sashelp.class;
  bmi = 703*weight/height**2;
run;
#{sas PROCstep}
proc means data=class; /* not SASHELP.class */
run;

`
Then I got error:

running: D:/SAS 9.4/SASFoundation/9.4/sas.exe sas49d85ed262a.sas -nosplash -linesize 75
Warning in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
running command '"D:/SAS 9.4/SASFoundation/9.4/sas.exe" sas49d85ed262a.sas -nosplash -linesize 75' had status 2
Error in knitrEngine(mergedOptions) :

Many thanks

Get and send data to R environment?

Hi, fantastic package!
My goal is often to compare SAS and R results, e.g. when fitting linear mixed models via PROC MIXED and glmmTMB(). Thus, I would like to

  1. Send data from R to SAS
  2. Send data from SAS to R

I know about the call ExportDataSetToR() and call ImportDataSetFromR() functions as e.g. described here, but I don't think they will work in this scenario.

So is my only option to write chunks that actually export and import files in the background or do you have a better solution?

collectcode doesn't work with sashtml5 engine

Hi, thanks for the great package! I will preface this by saying I am a newb at SASmarkdown, and to some extent also SAS. Apologies in advance if this has a simple solution, but I was unable to find it in the documentation.

The issue is that for some reason the collectcode = TRUE argument works for some SAS engines, not others. I have been able to successfully get it to work using the sas and sashtml engines, but not sashtml5. Is this expected behavior?

For reference I am working with Windows 10 x64, R 4.2.2, and SASmarkdown 0.8.0.

Example .Rmd is below. It returns an error that WORK.POWER_EXAMPLE_1 is not found if using sashtml5, but works as expected if using sas or sashtml engine.

Thanks in advance for your help!

```{r setup, include = FALSE}
library(SASmarkdown)
```


```{sashtml5, collectcode = TRUE}
data power_example_1;
  input trt mu;
  do obs = 1 to 5;
    output;
  end;
datalines;
0 20
1 25
2 25
;
```

blah blah

```{sashtml5}
proc glimmix data = power_example_1;
  class trt;
  model mu = trt;
  parms (9) / hold = 1;
  contrast 'control vs experimental' trt 2 -1 -1;
  contrast 'control vs experimental 1' trt 1 -1;
  contrast 'control vs experimental 2' trt 1 0 -1;
  contrast 'experimental 1 vs experimental 2' trt 0 1 -1;
  lsmeans trt / diff cl;
  ods output tests3 = F_overall contrasts = F_contrasts;
run;
```

Provide server credentials to SAS engine

Hi,

When trying run sas chunck code, I need to provide my SASapp server credentials.

I have tried to pass different options to the sasopts argument without success.

Anu sggestions ?


# load the SASmarkdown package
library(SASmarkdown)

# set up the options so that knit knows where you SAS executable is
# set the linesize to be easily readable on letter size paper, portrait
# and set the knir options using opts_chunk$set().
saspath <- "C:/Program Files (x86)/SASHome/x86/SASEnterpriseGuide/7.1/SEGuide.exe" 
sasopts <- "-nosplash -linesize 75 -password_on_stdin true -metauser xxxx-metapass xxxx -user_ID xxxx-password xxxx-serverusername xxxx-serverpassword xxxx"

knitr::opts_chunk$set(engine="sas", engine.path=saspath,engine.opts=sasopts, comment=NA)

# run these commands to convince yourself that
# within this knitr session the engine changed.
knitr::opts_chunk$get()$engine
knitr::opts_chunk$get()$engine.path
knitr::opts_chunk$get()$engine.opts

data _null_;
put 'Hello, world!';
run;

`find_sas()` only search the default path on windows

The find_sas() function only search for the default installation path of SAS on windows platform, which means this will not work for SAS installed at custom path. But actually one can use Sys.which("sas") to determine whether sas.exe is in the PATH, just like that in the Linux branch of find_sas().

So I'm curious if this is by design? My SAS is installed in a custom path in D drive and when loading the package

sasexe <- find_sas()

reports NULL, which results to following setting of engine.path is not excecuted and leads to the out.log not found issue I'v encountered

Can SAShtml work with chinese version SAS?

I tried to use SAS Chinese version engine sashtml to make graphics
This is mycode
Q1
The error will be like this
Q2.
Or
Can SASmarkdown attach graphics on pdf file directly? when I use SAS Chinese version engine sas pdf, It will give me a PNG file for graphics.

Adapt collectcode option for non-standard location of autoexec files

I was able to use your package calling SAS from a corporate server, and so far it's been awesome!
I had to set several of the SAS options, where basically everything is in a different location: SAS, the SAS config file, and the autoexec file, and my working directory.

To do so, I had been using the following in my sasopts. This works fine when I don't want to use collectcode. The sysparm options are for setting certain system environment parameters that are required for this particular autoexec file.

"-autoexec /serverpath/autoexec.sas -sysparm var1=sysparam1,var2=sysparam2"

If I understand correctly how collectcode works, then applying the option to a code chunk will write that code chunk to the end of the autoexec. However, this is not working in my situation where my autoexec does not exist within my working directory and cannot be edited in its original directory. My current workaround is to make a new autoexec. It looks something like this, where I had to set some environment variables that are needed for passing through to the autoexec.

%let var1=sysparam1;
%let var2=sysparam2;
%include "/serverpath/autoexec.sas";

Would it be possible to expand this function to additionally look for the autoexec in a defined location, then write and use a temporary new autoexec file with the arguments for the autoexec and system parameters?

Can't get saspdf engine to run in R Markdown

I am trying to follow these instructions to generate SAS LaTeX output in R Markdown. The instructions do not indicate that any special chunk options are required when using the saspdf engine, so I used the chunk options suggested here. However, when I compile the .Rmd file to a PDF, I get the following error message:

Error in `engine()`:
! object 'out.log' not found

Below is my minimal working example of an R Markdown file. The data file abc.csv consists of just a column of letters a to e and a column of numbers 1 to 5. The compile is successful (with verbatim output) if the engine is set to sas in the chunk, but if I change it to saspdf to generate LaTeX output, the above error is thrown.

---
title: "SAS Markdown"
output: pdf_document
---
library(knitr)
library(SASmarkdown)

saspath <- find_sas()
sasopts <- "-nosplash -ls 75" # '-nosplash' fails in Unix terminals
opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
               engine.opts=list(sas=sasopts, saslog=sasopts),
                      comment=NA,
                      echo=TRUE, collectcode = TRUE)

SAS Markdown

proc import datafile="abc.csv" dbms=csv
 out=abc;
run;

proc contents data=abc;
run;

8.5 chapter - possible typo

I guess there is a possible typo (missing "s") in the last word of the following part of the code

knitr::opts_chunk$set(engine.opts=list(sas=sasopts, saslog=sasopts,
sashtml=sasopts, sashtmllog=sasopt))

Can SASmarkdown use SAS chinese version?

my dataset contain chinese characters which are necessary I have SAS chinese version but when I use {r, engine="sas",saspath="sas.exe"} it always opens SAS english. I cannot run Chinese datafile in pure SAS.exe.
SAS chinese open like "C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\zh\sasv9.cfg"

"error in system2"

Hello,

Thanks so much for building this amazing package. I encountered an issue running the first SAS chunk after installation, the full message is copied below. Looking forward to resolving this issue and exploring the full power of the package! Thanks in advance for your help.

I tried installing SASmarkdown using install.packages("SASmarkdown) and devtools::install_github("Hemken/SASmarkdown"). Both installations seem successful - I saw the correct message
"library(SASmarkdown)
SAS found at C:/Program Files/SASHome/SASFoundation/9.4/sas.exe
SAS engines are now ready to use."

However, when I run the testing code below, it gives me the system2 error.

proc means data=sashelp.class;
run;

"running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75
Error in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
'CreateProcess' failed to run 'C:\PROGRA1\SASHome\SASFOU1\9.4\sas.exe sas2fe02fcf776f.sas -nosplash -linesize 75'"

Use of many code chunks

Hello,

The export to HTML, PDF and Word is OK if I run many SAS proc in the same code chunk :

```{r, engine='sas', collectcode=TRUE, error=TRUE}

proc print data=sashelp.class (obs=3);
run;

proc means data=sashelp.class;
  var Age Height Weight;
run;

                  Obs.     Name      Sex    Age    Height    Weight

                    1     Alfred      M      14     69.0      112.5
                    2     Alice       F      13     56.5       84.0
                    3     Barbara     F      13     65.3       98.0
 
                                                                                     
 
                                   Procédure MEANS

   Variable     N         Moyenne      Ecart-type         Minimum         Maximum
   ------------------------------------------------------------------------------
   Age         19      13.3157895       1.4926722      11.0000000      16.0000000
   Height      19      62.3368421       5.1270752      51.3000000      72.0000000
   Weight      19     100.0263158      22.7739335      50.5000000     150.0000000
   ------------------------------------------------------------------------------

but not if I use many code chunks :

```{r, engine='sas', collectcode=TRUE, error=TRUE}

proc print data=sashelp.class (obs=3);
run;

                  Obs.     Name      Sex    Age    Height    Weight

                    1     Alfred      M      14     69.0      112.5
                    2     Alice       F      13     56.5       84.0
                    3     Barbara     F      13     65.3       98.0

```{r, engine='sas', collectcode=TRUE, error=TRUE}

proc means data=sashelp.class;
  var Age Height Weight;
run;

                                                                     Le Système SAS 1
                                                      20:00 Wednesday, March 11, 2020

                  Obs.     Name      Sex    Age    Height    Weight

                    1     Alfred      M      14     69.0      112.5
                    2     Alice       F      13     56.5       84.0
                    3     Barbara     F      13     65.3       98.0
 
                                                                                     
 
                                   Procédure MEANS

   Variable     N         Moyenne      Ecart-type         Minimum         Maximum
   ------------------------------------------------------------------------------
   Age         19      13.3157895       1.4926722      11.0000000      16.0000000
   Height      19      62.3368421       5.1270752      51.3000000      72.0000000
   Weight      19     100.0263158      22.7739335      50.5000000     150.0000000
   ------------------------------------------------------------------------------

Session info :

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SASmarkdown_0.5.2

loaded via a namespace (and not attached):
 [1] compiler_3.6.3  htmltools_0.4.0 tools_3.6.3     yaml_2.2.1      Rcpp_1.0.3      rmarkdown_2.1  
 [7] knitr_1.28      digest_0.6.25   xfun_0.12       rlang_0.4.5     evaluate_0.14  

Many thanks,

Chunk option SASnotes=FALSE removes only the first line of notes

Hello,

The chunk option SASnotes=FALSE removes only the first line of notes :

```{r, engine="saslog", engine.path=sasexe, engine.opts=sasopts}

2          data test_note_on_two_lines;
3            set sashelp.class;
4          run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST_NOTE_ON_TWO_LINES has 19 observations and 5 
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds

```{r, engine="saslog", engine.path=sasexe, engine.opts=sasopts, SASproctime=FALSE, SASnotes=FALSE}

2          data test_note_on_two_lines;
3            set sashelp.class;
4          run;

      variables.

Many thanks,

Error: attempt to use zero-length variable name

I get the error whenever I attempt the examples at: https://www.ssc.wisc.edu/~hemken/SASworkshops/Markdown/SASmdpackage.html

Statements Executed and Log:

install.packages("SASmarkdown")
Error in install.packages : Updating loaded packages
Restarting R session...
install.packages("SASmarkdown")
Installing package into ‘\CLINICALVM1/Users//Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/SASmarkdown_0.4.3.zip'
Content type 'application/zip' length 543587 bytes (530 KB)
downloaded 530 KB
package ‘SASmarkdown’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users<username>\AppData\Local\Temp\2\RtmpsfrEvn\downloaded_packages
help(package="SASmarkdown")
require(SASmarkdown)
Loading required package: SASmarkdown
sas, saslog, sashtml, and sashtmllog engines
are now ready to use.
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 75"
knitr::opts_chunk$set(engine='sas', engine.path=saspath, engine.opts=sasopts, comment="")

Error: attempt to use zero-length variable name

User setting for chunk options: SASecho, SASproctime and SASnotes

Dear Maintainer and Author,

I am a SASMarkdown user for more than 1 year, and recently (under v 0.8.2), I was trying to set the chunk options:
SASproctime, SASecho, SASnotes to either FALSE or TRUE in the SAS log under sashtml5 engine without success, the results always show SASecho only without SASproctime and SASnotes, i.e., "SASecho=T, SASproctime=F,SASnotes=F".

Could shed some lights on the following Rmd codes and point out where I make the mistake in using of saslog_hookset()? Thank you,

Settings under sasMarkdown version 0.8.2, R 4.3.1, SAS 9.4 (TS1M4)

```{r setup, include=FALSE}
library(knitr)
library(SASmarkdown)

sasexe <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 80 -ps 60"
knitr::opts_chunk$set(
engine.path=list(sashtml5=sasexe),
engine.opts=list(sashtml5=sasopts),
comment=NA)
knit_hooks$set(source=sasloghook)
```

SASecho, SASproctime and SASnotes were not controlled properly under sashtml5.

```{sashtml5 bug, SASecho=F, SASproctime=T,SASnotes=T}
ods html5 style=htmlblue;
proc corr data=sashelp.class plots=matrix;
run;
```

Sas execution stuck, command line seems to be sent twice

Hello,

this is the first time I try to use Sasmardown. Thank you for letting us the opportunity to document Sas sources for students.

I try to run a very simple exemple for a start :


title: "Sas markdown test"
author: "Goze"
date: "27 novembre 2019"
output: html_document

knitr::opts_chunk$set(echo = TRUE)
saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe"
sasopts <- "-nosplash -ls 75"
knitr::opts_chunk$set(engine.path=list(sas=saspath, saslog=saspath),
                      engine.opts=list(sas=sasopts, saslog=sasopts), 
                      comment=NA)
library(SASmarkdown)
proc means data=sashelp.class;
run;

processing file: Sas-markdown-test.Rmd
|......... | 14%
ordinary text without R code

|................... | 29%
label: setup (with options)
List of 1
$ include: logi FALSE

|............................ | 43%
ordinary text without R code

|..................................... | 57%
label: libload (with options)
List of 1
$ echo: logi TRUE

|.............................................. | 71%
ordinary text without R code

|........................................................ | 86%
label: ex-sas (with options)
List of 1
$ engine: chr "sashtml"

running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exeC:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas40ec2be11dc1.sas -nosplash -ls 75sas40ec2be11dc1.sas -nosplash -ls 75

For the moment,, Sas execution command hangs with the follwing output in th Rmarkdown tab :

processing file: Sas-markdown-test.Rmd
|......... | 14%
ordinary text without R code

|................... | 29%
label: setup (with options)
List of 1
$ include: logi FALSE

|............................ | 43%
ordinary text without R code

|..................................... | 57%
label: libload (with options)
List of 1
$ echo: logi TRUE

|.............................................. | 71%
ordinary text without R code

|........................................................ | 86%
label: ex-sas (with options)
List of 1
$ engine: chr "sashtml"

running: C:/Program Files/SASHome/SASFoundation/9.4/sas.exeC:/Program Files/SASHome/SASFoundation/9.4/sas.exe sas40ec2be11dc1.sas -nosplash -ls 75sas40ec2be11dc1.sas -nosplash -ls 75

Cheers,

Eric

Autoexec clashes

Allow autoexec.sas to "collect code", even if there is an existing autoexec?

Chunk option SASnote / SASproctime

Hello,

In SAS, SASnote and SASproctime are considered as notes :

1    data test;
2      set sashelp.class;
3    run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
1    option nonotes;
2    data test;
3      set sashelp.class;
4    run;

With SASmarkdown :

```{r, engine='saslog', collectcode=TRUE, error=TRUE, SASnotes=TRUE, SASproctime=FALSE}

2          data test;
3            set sashelp.class;
4          run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):

```{r, engine='saslog', collectcode=TRUE, error=TRUE, SASnotes=FALSE, SASproctime=TRUE}

2          data test;
3            set sashelp.class;
4          run;

      real time           0.00 seconds
      cpu time            0.00 seconds

The NOTE "DATA statement used (Total process time):" should also be associated to SASproctime.

Linked to #9 (comment).

Many thanks,

Black and White graphics output using SASmarkdown but not SAS in batch mode?

I'm having trouble figuring out exactly why SASmarkdown is generating all black-and-white figures, when the same code works in batch mode to generate color figures.

I'm working on Ubuntu 18.04, with SAS 9.4.

Here's some code to demonstrate the issue:

indoc <- '
---
title: reprex
output: html_document
---

```{r load-sas-libraries, echo =T, message = F, warning = F}
library(SASmarkdown)
sas_enginesetup()
```

```{r echo=T}
writeLines(c(
"PROC SGPLOT data=sashelp.snacks;",
"SCATTER x = date y = QtySold /",
"  markerattrs=(size=8pt symbol=circlefilled)",
"  group = product; /* maps to point color by default */",
"RUN;",
"QUIT;"
), con = "reprex.sas")
```


```{r as-in-book, engine="sashtml", engine.path = "sas"}
%include "reprex.sas";
```


```{r}
system("sas reprex.sas")
```

![](SGPlot.png)
'
knitr::knit(text=indoc, output="test.md")
rmarkdown::render("test.md")

Which looks like this when rendered:

image

As you can see, the SAS code chunk produces a black-and-white graph, while the batch output renders a graph which is produced in color.

Actual graph files generated

as-in-book

SGPlot

I don't know SAS that well, so I'm open to the possibility that there is just an obvious option that I'm missing here, but if that's the case, why does batch mode produce color graphs while SASmarkdown produces black-and-white graphs?

Thanks for the help.


Cleanup: You can remove the files generated by this reprex from your machine using file.remove(c("SGPlot.png","as-in-book.png", "test.md", "test.html")) in R.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.